Urara-Blog/node_modules/.pnpm-store/v3/files/03/5c733089baa42a53cabe6dc1e0d3adb35f3cc7f8288b2258977c4bc683ec72bf11030d04faab31a9c8543bb47287295580863fff3c46e75c274f7593923e1a
2022-08-14 01:14:53 +08:00

29 lines
No EOL
756 B
Text

"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, "comments", ...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;
}
}