source: trip-planner-front/node_modules/@babel/types/lib/modifications/removeProperties.js@ 6a3a178

Last change on this file since 6a3a178 was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago

initial commit

  • Property mode set to 100644
File size: 765 bytes
Line 
1"use strict";
2
3Object.defineProperty(exports, "__esModule", {
4 value: true
5});
6exports.default = removeProperties;
7
8var _constants = require("../constants");
9
10const CLEAR_KEYS = ["tokens", "start", "end", "loc", "raw", "rawValue"];
11
12const CLEAR_KEYS_PLUS_COMMENTS = _constants.COMMENT_KEYS.concat(["comments"]).concat(CLEAR_KEYS);
13
14function removeProperties(node, opts = {}) {
15 const map = opts.preserveComments ? CLEAR_KEYS : CLEAR_KEYS_PLUS_COMMENTS;
16
17 for (const key of map) {
18 if (node[key] != null) node[key] = undefined;
19 }
20
21 for (const key of Object.keys(node)) {
22 if (key[0] === "_" && node[key] != null) node[key] = undefined;
23 }
24
25 const symbols = Object.getOwnPropertySymbols(node);
26
27 for (const sym of symbols) {
28 node[sym] = null;
29 }
30}
Note: See TracBrowser for help on using the repository browser.