canjs / can-view-scope

Scope management for view engines
https://canjs.com/doc/can-view-scope.html
MIT License
4 stars 0 forks source link

Improve missing key warning #208

Closed cherifGsoul closed 5 years ago

cherifGsoul commented 5 years ago

Fixes #206

This improves the missing key warning by logging of the property it can read for example:

var context = { foo: true };

var scope = new Scope(context);
var scopeKeyData = scope.computeData("foo.length", {
   warnOnMissingKey: true
});

scopeKeyData.read();  // -> Unable to find key "foo.length". Found "foo" with value: true