How to use javascript proxy for nested objects

You can add a get trap and return a new proxy with validator as a handler: var validator = { get(target, key) { if (typeof target[key] === ‘object’ && target[key] !== null) { return new Proxy(target[key], validator) } else { return target[key]; } }, set (target, key, value) { console.log(target); console.log(key); console.log(value); return true } … Read more

Javascript ES6 TypeError: Class constructor Client cannot be invoked without ‘new’

The problem is that the class extends native ES6 class and is transpiled to ES5 with Babel. Transpiled classes cannot extend native classes, at least without additional measures. class TranspiledFoo extends NativeBar { constructor() { super(); } } results in something like function TranspiledFoo() { var _this = NativeBar.call(this) || this; return _this; } // … Read more

es6 Map and Set complexity, v8 implementation

Is it a fair assumption that in v8 implementation retrieval / lookup is O(1)? Yes. V8 uses a variant of hash tables that generally have O(1) complexity for these operations. For details, you might want to have a look at https://codereview.chromium.org/220293002/ where OrderedHashTable is implemented based on https://wiki.mozilla.org/User:Jorend/Deterministic_hash_tables.