@lcap/nasl-parser
Version:
Take Nasl text to Nasl AST with the help of generalized parsing.
29 lines • 1.18 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.removeUnimportantProps = void 0;
exports.extractFirstLogic = extractFirstLogic;
exports.removeSomeProperties = removeSomeProperties;
const common_util_1 = require("./toAST/common-util");
function extractFirstLogic(arg) {
return arg.logics[0];
}
function removeSomeProperties(ast, props) {
return new common_util_1.Visitor().preOrderVisitAll(null, ast, (env, obj) => {
if (!obj) {
return obj;
}
for (const prop of props) {
if (obj[prop] !== undefined) {
delete obj[prop];
}
}
return obj;
}, null);
}
const removeUnimportantProps = (arg) => {
return removeSomeProperties(arg, ['changedTime', 'uuid', 'offsetX', 'offsetY', 'folded', 'playground', '_aiUID', 'ideVersion', 'configuration']
.concat(['inferred', 'handleError', 'hideMembers', 'keyword', 'composedBy', 'cron', 'overridable', 'transactional', 'triggerType', 'applyAnnotations']));
};
exports.removeUnimportantProps = removeUnimportantProps;
// , 'description', 'name', 'label'
//# sourceMappingURL=nasl-json-util.js.map