Sha256: 0cc00834ff6103b534a1e6bee34981019f03b6610f3c1fcd889ceee0dd582bc8

Contents?: true

Size: 765 Bytes

Versions: 67

Compression:

Stored size: 765 Bytes

Contents

"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;
  }
}

Version data entries

67 entries across 59 versions & 11 rubygems

Version Path
optimacms-0.1.61 spec/dummy/node_modules/@babel/types/lib/modifications/removeProperties.js
disco_app-0.18.0 test/dummy/node_modules/@babel/types/lib/modifications/removeProperties.js
disco_app-0.18.2 test/dummy/node_modules/@babel/types/lib/modifications/removeProperties.js
trusty-cms-5.0.7 node_modules/@babel/types/lib/modifications/removeProperties.js
trusty-cms-5.0.6 node_modules/@babel/types/lib/modifications/removeProperties.js
trusty-cms-5.0.5 node_modules/@babel/types/lib/modifications/removeProperties.js
trusty-cms-5.0.4 node_modules/@babel/types/lib/modifications/removeProperties.js
disco_app-0.16.1 test/dummy/node_modules/@babel/preset-modules/node_modules/@babel/types/lib/modifications/removeProperties.js
disco_app-0.16.1 test/dummy/node_modules/@babel/types/lib/modifications/removeProperties.js
disco_app-0.15.2 test/dummy/node_modules/@babel/preset-modules/node_modules/@babel/types/lib/modifications/removeProperties.js
disco_app-0.15.2 test/dummy/node_modules/@babel/types/lib/modifications/removeProperties.js
trusty-cms-5.0.3 node_modules/@babel/types/lib/modifications/removeProperties.js
trusty-cms-5.0.2 node_modules/@babel/types/lib/modifications/removeProperties.js
disco_app-0.18.4 test/dummy/node_modules/@babel/preset-modules/node_modules/@babel/types/lib/modifications/removeProperties.js
disco_app-0.18.4 test/dummy/node_modules/@babel/types/lib/modifications/removeProperties.js
disco_app-0.18.1 test/dummy/node_modules/@babel/types/lib/modifications/removeProperties.js
disco_app-0.18.1 test/dummy/node_modules/@babel/preset-modules/node_modules/@babel/types/lib/modifications/removeProperties.js
disco_app-0.12.7.pre.puma.pre.3 test/dummy/node_modules/@babel/preset-modules/node_modules/@babel/types/lib/modifications/removeProperties.js
disco_app-0.12.7.pre.puma.pre.3 test/dummy/node_modules/@babel/types/lib/modifications/removeProperties.js
disco_app-0.14.0 test/dummy/node_modules/@babel/preset-modules/node_modules/@babel/types/lib/modifications/removeProperties.js