samvv / js-proxy-deep

A JavaScript Proxy object that automatically nests itself

Home Page:https://npmjs.com/proxy-deep

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Example doesn't work

ChuckJonas opened this issue · comments

When I try to run the example on this project, I get the following error:

db.select.from.where is not a function

const DeepProxy = require('proxy-deep');
 
const db = new DeepProxy({}, {
  get(target, path, receiver) {
    return this.nest()
  },
  apply(target, thisArg, argList) {
    return this.path;
  }
})
 
console.log(db.select.from.where()) // outputs ['select', 'from', 'where']

I hope I'm doing something wrong, as this is pretty much exactly what I need for my usecase!

Repro Link

Hi, sorry for not responding sooner. This seems to be a bug in the example, not in the library. The call to nest should have gotten an anonymous function as argument, so that JavaScript knows it is callable. I will fix it along with some other improvements.