Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added support for nested property accessor #34

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

Added support for nested property accessor #34

wants to merge 2 commits into from

Conversation

AnsonT
Copy link

@AnsonT AnsonT commented Mar 16, 2021

Added support to access nested properties in the external data

        eq(42, compileExpression('a')(Object.create({a: 42})));
        eq(42, compileExpression('a.b')(Object.create({a: { b: 42}})));
        eq(42, compileExpression('a["b"]')(Object.create({a: { b: 42 }})));
        eq(42, compileExpression("a['b']")(Object.create({a: { b: 42 }})));
        eq(42, compileExpression('a["b"].c')(Object.create({a: { b: { c: 42 } }})));
        eq(42, compileExpression('a["b"]["c"]')(Object.create({a: { b: { c: 42 } }})));
        eq(42, compileExpression('a.b[0]')(Object.create({a: { b: [42]}})));
        eq(42, compileExpression('a.b[0].c')(Object.create({a: { b: [{ c: 42 }]}})));

@cshaa
Copy link
Contributor

cshaa commented Mar 18, 2021

Hey Anson,
Sorry to disappoint you, but this repo has been dead for quite some time. See my fork for an up-to-date version. Currently, there already is a property accessor in filtrex, it's the operator of. One would use it like this:

eq(42, compileExpression("b of a")(Object.create({a: { b: 42 }})));

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants