Use ES6 Proxy to throw on non-existing assertions
See original GitHub issueWith ES6 proxies it should be possible to have the following:
expect(someVariable).to.exiist;
throw which would remove one of the reasons why assertions on property access are problematic.
This will still need to work in browsers not supporting ES6 proxies (now: all browsers but this will soon change).
Refs #56.
Issue Analytics
- State:
- Created 8 years ago
- Comments:19 (8 by maintainers)
Top Results From Across the Web
3 ways to use ES6 proxies to enhance your objects
In this article, we will cover three things you can do with proxies that will enhance your objects.
Read more >How to throw error when accessing non existent property of ...
ES2015+ offers proxies, and if you wrap the object in a proxy, you can then have the proxy throw an error when you...
Read more >Creating defensive objects with ES6 proxies
This proxy uses a new object as its target (the first argument to ... The goal is to throw an error whenever a...
Read more >Metaprogramming with Proxies • Deep JavaScript - Exploring JS
Let's use JavaScript as both metaprogramming language and base programming language. ... assert.equal(proxy.city, 'Paris'); revoke(); assert.throws( ...
Read more >Proxies and Reflection | es6
A proxy, created using new Proxy() , is an object that you use in place of ... of JavaScript is that reading nonexistent...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
This is the obvious and right solution imo. It’d be a breaking change, sure, but it’d be worth it.
Added in #721