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

Possible to ignore certain fields? #14

Open
smucode opened this issue Apr 28, 2023 · 3 comments
Open

Possible to ignore certain fields? #14

smucode opened this issue Apr 28, 2023 · 3 comments

Comments

@smucode
Copy link

smucode commented Apr 28, 2023

Is it possible to ignore certain fields? Eg. in this example, both records are matched as the _id matches 1:

const EasyFilter = require('@noriller/easy-filter')

const array = [
	{ _id: 1, name: "John", age: 42, tags: ["Foo", "Bar"] },
	{ _id: 2, name: "Jane", age: 69, tags: ["Bar", "Baz", "123"] }
]

const filter = EasyFilter.default(array)
const result = filter.search('1')

Also note that you'll have to use EasyFilter.default when using require. Not sure if that's expected or not.

@Noriller
Copy link
Owner

I didn't know about the default thing with require. Since then I've learned about some better ways to build from TS to JS, when I get around to using it here it should help on things like this

In the case:

const result = filter.search('1 not(_id:1)')

Right now, the best way to ignore certain fields would be to filter then while instantiating filter.

@smucode
Copy link
Author

smucode commented Apr 29, 2023 via email

@Noriller
Copy link
Owner

Sorry, you're right.
Hmm... I can think of a few ways, but I'll have to think about how to best do it.

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

No branches or pull requests

2 participants