We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
negate
1 parent a3304b9 commit ae9df9cCopy full SHA for ae9df9c
src/token-predicate.mjs
@@ -1,19 +1,10 @@
1
-/**
2
- * Negate the result of `this` calling.
3
- * @param {Token} token The token to check.
4
- * @returns {boolean} `true` if the result of `this(token)` is `false`.
5
- */
6
-function negate0(token) {
7
- return !this(token) //eslint-disable-line no-invalid-this
8
-}
9
-
10
/**
11
* Creates the negate function of the given function.
12
* @param {function(Token):boolean} f - The function to negate.
13
* @returns {function(Token):boolean} Negated function.
14
*/
15
function negate(f) {
16
- return negate0.bind(f)
+ return (token) => !f(token)
17
}
18
19
0 commit comments