23 lines
322 B
JavaScript
23 lines
322 B
JavaScript
|
'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;
|