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

Negate function #179

Closed
jeswr opened this issue Jul 7, 2020 · 1 comment
Closed

Negate function #179

jeswr opened this issue Jul 7, 2020 · 1 comment

Comments

@jeswr
Copy link

jeswr commented Jul 7, 2020

Describe the solution you'd like
A function that negates another function. If f(...p) = true then negate(f)(...p) = false and vice versa.

Additionally propose a solution
Function that negates a function that returns boolean values

Type Signature
((...p) -> Bool) -> ((...p) -> Bool)

Possible implementation
const negate = f => R.compose(R.not, f)

Example use cases

const notIn = negate(R.has)
@jbradle
Copy link
Collaborator

jbradle commented Jul 7, 2020

Looks like complement from ramda library.

@jeswr jeswr closed this as completed Jul 7, 2020
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