eslint-plugin-de-morgan
Version:
ESLint plugin for transforming negated boolean expressions via De Morgan’s laws
14 lines (13 loc) • 531 B
JavaScript
import { createTestWithParameters } from './create-test-with-parameters.js'
import { isUnaryExpression } from './is-unary-expression.js'
import { hasOperator } from './has-operator.js'
/**
* Checks whether the given expression is a UnaryExpression with operator '!'.
*
* @param node - The AST node to check.
* @returns True if the node is a UnaryExpression with operator '!'.
*/
function hasNegationOperator(node) {
return createTestWithParameters(node)(isUnaryExpression, hasOperator('!'))
}
export { hasNegationOperator }