Comments (3)
Hi Winston! I apologize for responding so late on this. I've been chewing on it ever since you posted it, and I keep arriving at this making the most sense as a constructor option that allows the programmer to enable JS-native functionality on throwing when a property of undefined is accessed.
I'm not in love the idea of using null
vs undefined
, because ultimately either of those things could be legitimate values inside the context. If Jexl threw an exception, that would make the difference quite clear -- at the expense of the programmer needing to catch the error if they enable this mode.
What do you think?
from jexl.
Hi! Yes, getting an exception would be good, especially if that exception can contain more information. If my expression was "foo.bar[12].gates.yellow", it'd be nice if the exception could indicate where exactly the undefined was.
from jexl.
Hi Tom, I'm having the same issue when comparing "null == undefined" or "null != undefined", both return back as undefined and will be true when comparing equality, when making a custom operator with using typeof undefined or typeof null both return a string "undefined", but typeof null should actually return a string "object" here instead of "undefined". This should resolve the issue.
from jexl.
Related Issues (20)
- Match operator not recognized HOT 2
- Opinions on functions vs transforms? HOT 3
- '&&' and '||' priority HOT 1
- -a(2,3) HOT 1
- Scientific number notation: 1e2, 2.1e-3 etc HOT 3
- Cannot index into static array or object HOT 4
- Is this project maintained? Do you want a hand? HOT 8
- Errors for bad identifiers HOT 1
- Object's prototype methods return undefined for token type
- Security? does it use actual JS eval function? HOT 1
- Problem with inline if HOT 1
- How to convert AST to an expression string? HOT 5
- Object keys with a space HOT 2
- Run in browser?
- Cannot read properties of undefined (reading '0')
- Backslashes are wrongly unescaped
- Keys with hyphens evaluate to null HOT 1
- Inconsistency between null and undefined operations HOT 1
- Transform Confusion HOT 1
- Minus token is confused for binaryOp in function arguments HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from jexl.