securityos/node_modules/eslint-plugin-unicorn/rules/ast/is-empty-node.js

21 lines
357 B
JavaScript
Raw Normal View History

2024-09-06 15:32:35 +00:00
'use strict';
function isEmptyNode(node, additionalEmpty) {
const {type} = node;
if (type === 'BlockStatement') {
return node.body.every(currentNode => isEmptyNode(currentNode, additionalEmpty));
}
if (type === 'EmptyStatement') {
return true;
}
if (additionalEmpty?.(node)) {
return true;
}
return false;
}
module.exports = isEmptyNode;