Skip to content

Commit

Permalink
fail on unknown properties (see #22) and ternary operator (see #34)
Browse files Browse the repository at this point in the history
  • Loading branch information
cshaa committed Jun 17, 2021
1 parent 1e6d4f9 commit 3730609
Show file tree
Hide file tree
Showing 12 changed files with 1,753 additions and 1,567 deletions.
1,073 changes: 566 additions & 507 deletions dist/browser/filtrex.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/browser/filtrex.min.js

Large diffs are not rendered by default.

1,073 changes: 566 additions & 507 deletions dist/cjs/filtrex.js

Large diffs are not rendered by default.

10 changes: 8 additions & 2 deletions dist/esm/filtrex.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -168,12 +168,18 @@ export function compileExpression(expression, options) {
// Metaprogramming functions

function prop(name, obj) {
return hasOwnProperty(obj||{}, name) ? obj[name] : undefined;
if (hasOwnProperty(obj||{}, name))
return obj[name];

throw new ReferenceError(`Property “${name}” does not exist.`)
}

function safeGetter(obj) {
return function get(name) {
return hasOwnProperty(obj||{}, name) ? obj[name] : undefined;
if (hasOwnProperty(obj||{}, name))
return obj[name];

throw new ReferenceError(`Property “${name}” does not exist.`)
}
}

Expand Down
Loading

0 comments on commit 3730609

Please sign in to comment.