UNPKG

@atlaskit/eslint-plugin-no-lookahead-lookbehind-regexp

Version:

Fork of https://github.com/JonasBa/eslint-plugin-no-lookahead-lookbehind-regexp

17 lines (16 loc) 625 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.isBinaryExpression = isBinaryExpression; exports.isRegExpLiteral = isRegExpLiteral; exports.isStringLiteralRegExp = isStringLiteralRegExp; function isRegExpLiteral(literal) { return 'regex' in literal; } function isStringLiteralRegExp(literal) { return literal.parent !== null && literal.parent.type === 'NewExpression' && literal.parent.callee.type === 'Identifier' && literal.parent.callee.name === 'RegExp'; } function isBinaryExpression(literal) { return literal.parent !== null && literal.parent.type === 'BinaryExpression'; }