diff options
Diffstat (limited to 'assets/node_modules/@babel/types/lib/modifications/removeProperties.js')
-rw-r--r-- | assets/node_modules/@babel/types/lib/modifications/removeProperties.js | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/assets/node_modules/@babel/types/lib/modifications/removeProperties.js b/assets/node_modules/@babel/types/lib/modifications/removeProperties.js new file mode 100644 index 0000000..f9cf8e6 --- /dev/null +++ b/assets/node_modules/@babel/types/lib/modifications/removeProperties.js @@ -0,0 +1,30 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = removeProperties; + +var _constants = require("../constants"); + +const CLEAR_KEYS = ["tokens", "start", "end", "loc", "raw", "rawValue"]; + +const CLEAR_KEYS_PLUS_COMMENTS = _constants.COMMENT_KEYS.concat(["comments"]).concat(CLEAR_KEYS); + +function removeProperties(node, opts = {}) { + const map = opts.preserveComments ? CLEAR_KEYS : CLEAR_KEYS_PLUS_COMMENTS; + + for (const key of map) { + if (node[key] != null) node[key] = undefined; + } + + for (const key of Object.keys(node)) { + if (key[0] === "_" && node[key] != null) node[key] = undefined; + } + + const symbols = Object.getOwnPropertySymbols(node); + + for (const sym of symbols) { + node[sym] = null; + } +}
\ No newline at end of file |