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

feature request: hasPresentKeys (plural) #3

Open
k-funk opened this issue May 13, 2021 · 2 comments
Open

feature request: hasPresentKeys (plural) #3

k-funk opened this issue May 13, 2021 · 2 comments

Comments

@k-funk
Copy link

k-funk commented May 13, 2021

const user1 = { name: 'Alice', email: '[email protected]' }
const user2 = { name: 'Bob' }
const user3 = { email: '[email protected]' }

const users = [user1, user2, user3].filter(hasPresentKeys('name, 'email'))

expect(users.length).toEqual(1) // only `user1`

Thoughts?


Could also consider a function like hasAtLeastOnePresentKey that behaves more like an || than an &&

@robertmassaioli
Copy link
Owner

I have no intention to implement this at this point in time, but I do accept PRs. If you created a PR for hasPresentKeys I would certainly review it.

@raed667
Copy link

raed667 commented Jan 25, 2024

Hey @robertmassaioli would you mind having a look at the proposed PR ?

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

3 participants