@jsdoc/ast
Advanced tools
+22
-38
@@ -16,6 +16,6 @@ /* | ||
| */ | ||
| // TODO: docs | ||
| import { name } from '@jsdoc/core'; | ||
| import { cast } from '@jsdoc/util'; | ||
| import _ from 'lodash'; | ||
@@ -76,33 +76,28 @@ import { Syntax } from './syntax.js'; | ||
| export function addNodeProperties(node) { | ||
| const newProperties = {}; | ||
| if (!node || typeof node !== 'object') { | ||
| if (!node) { | ||
| return null; | ||
| } | ||
| if (!node.nodeId) { | ||
| newProperties.nodeId = { | ||
| Object.defineProperties(node, { | ||
| enclosingScope: { | ||
| // `null` means 'no enclosing scope', so use `undefined` for now. | ||
| value: undefined, | ||
| writable: true, | ||
| }, | ||
| enclosingScopeId: { | ||
| enumerable: true, | ||
| get() { | ||
| return this.enclosingScope ? this.enclosingScope.nodeId : null; | ||
| }, | ||
| }, | ||
| nodeId: { | ||
| value: `astnode${uid++}`, | ||
| enumerable: true, | ||
| }; | ||
| } | ||
| if (_.isUndefined(node.parent)) { | ||
| newProperties.parent = { | ||
| // `null` means 'no parent', so use `undefined` for now | ||
| }, | ||
| parent: { | ||
| // `null` means 'no parent', so use `undefined` for now. | ||
| value: undefined, | ||
| writable: true, | ||
| }; | ||
| } | ||
| if (_.isUndefined(node.enclosingScope)) { | ||
| newProperties.enclosingScope = { | ||
| // `null` means 'no enclosing scope', so use `undefined` for now | ||
| value: undefined, | ||
| writable: true, | ||
| }; | ||
| } | ||
| if (_.isUndefined(node.parentId)) { | ||
| newProperties.parentId = { | ||
| }, | ||
| parentId: { | ||
| enumerable: true, | ||
@@ -112,16 +107,5 @@ get() { | ||
| }, | ||
| }; | ||
| } | ||
| }, | ||
| }); | ||
| if (_.isUndefined(node.enclosingScopeId)) { | ||
| newProperties.enclosingScopeId = { | ||
| enumerable: true, | ||
| get() { | ||
| return this.enclosingScope ? this.enclosingScope.nodeId : null; | ||
| }, | ||
| }; | ||
| } | ||
| Object.defineProperties(node, newProperties); | ||
| return node; | ||
@@ -128,0 +112,0 @@ } |
+4
-4
| { | ||
| "name": "@jsdoc/ast", | ||
| "version": "0.2.8", | ||
| "version": "0.2.9", | ||
| "description": "JSDoc tools for working with abstract syntax trees (ASTs).", | ||
@@ -34,4 +34,4 @@ "keywords": [ | ||
| "dependencies": { | ||
| "@babel/parser": "^7.23.4", | ||
| "@jsdoc/core": "^0.5.5", | ||
| "@babel/parser": "^7.23.5", | ||
| "@jsdoc/core": "^0.5.6", | ||
| "@jsdoc/util": "^0.3.2", | ||
@@ -43,3 +43,3 @@ "lodash": "^4.17.21" | ||
| }, | ||
| "gitHead": "be73e2bfe226e9288fdfcc73f15917bfb65d11e8" | ||
| "gitHead": "3e4f5fc5570472d398a6a28d2b6080e8ec7cdfb5" | ||
| } |
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
52252
-0.71%1228
-0.89%Updated
Updated