You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Found part of the issue, the pattern parser is sensitive to whitespace around the == comparison:
const JSPath = require('jspath');
// works (spaces around ==)
console.log(JSPath.apply('.{.x == $name}', {
'x': 7
}, {
name: 7
}));
// fails (no spaces around ==)
console.log(JSPath.apply('.{.x==$name}', {
'x': 7
}, {
name: 7
}));
Output:
[ { x: 7 } ]
Error: Unexpected token "name"
at throwError (/home/runner/node_modules/jspath/lib/jspath.js:671:21)
at throwUnexpected (/home/runner/node_modules/jspath/lib/jspath.js:661:9)
at parsePrimaryExpr (/home/runner/node_modules/jspath/lib/jspath.js:364:16)
at parseUnaryExpr (/home/runner/node_modules/jspath/lib/jspath.js:342:16)
at parseMultiplicativeExpr (/home/runner/node_modules/jspath/lib/jspath.js:288:20)
at parseAdditiveExpr (/home/runner/node_modules/jspath/lib/jspath.js:274:20)
at parseRelationalExpr (/home/runner/node_modules/jspath/lib/jspath.js:260:20)
at parseEqualityExpr (/home/runner/node_modules/jspath/lib/jspath.js:241:20)
at parseEqualityExpr (/home/runner/node_modules/jspath/lib/jspath.js:252:31)
at parseLogicalANDExpr (/home/runner/node_modules/jspath/lib/jspath.js:223:20)
So I'm also not sure if substitutions can work for node names, which means that the second example JSPath.apply(".$name", { 'hello world': 7 }, {name: 'hello world'}); in #25 probably can't work either. It would be good to update that issue to mention that, since I kind of went on a wild goose chase to get to this issue.
I think there might be a problem with the current version of JSPath, or maybe I'm doing something wrong?
Output:
Should be:
Live demo:
https://repl.it/@ZackMorris1/UnrealisticPrevailingWheel
The text was updated successfully, but these errors were encountered: