securityos/node_modules/eslint-plugin-unicorn/rules/ast/is-new-expression.js

23 lines
322 B
JavaScript
Raw Normal View History

2024-09-06 15:32:35 +00:00
'use strict';
function isNewExpression(node, options) {
if (node?.type !== 'NewExpression') {
return false;
}
const {
name,
} = {
...options,
};
if (name) {
return node.callee.type === 'Identifier' && node.callee.name === name;
}
/* c8 ignore next */
return true;
}
module.exports = isNewExpression;