diff options
| author | littleblack111 <littleblack11111@gmail.com> | 2026-05-18 23:10:59 +0800 |
|---|---|---|
| committer | littleblack111 <littleblack11111@gmail.com> | 2026-05-18 23:41:44 +0800 |
| commit | fc87c009806dcc98867f6b58efe29b042aa01dee (patch) | |
| tree | 8f59b3f4a5b66e9dfef2d40c8d318e258a521228 /node_modules/babel-plugin-minify-simplify/lib/helpers.js | |
| parent | 3336b2356ee6152d9c6ae59bd9b87ccbc0958407 (diff) | |
node: updatemain
Diffstat (limited to 'node_modules/babel-plugin-minify-simplify/lib/helpers.js')
| -rw-r--r-- | node_modules/babel-plugin-minify-simplify/lib/helpers.js | 56 |
1 files changed, 0 insertions, 56 deletions
diff --git a/node_modules/babel-plugin-minify-simplify/lib/helpers.js b/node_modules/babel-plugin-minify-simplify/lib/helpers.js deleted file mode 100644 index dfbe7c2a..00000000 --- a/node_modules/babel-plugin-minify-simplify/lib/helpers.js +++ /dev/null @@ -1,56 +0,0 @@ -"use strict"; - -const VOID_0 = t => t.unaryExpression("void", t.numericLiteral(0), true); - -const evaluate = require("babel-helper-evaluate-path"); // Types as Symbols - for comparing types - - -const types = {}; // This is a test key which is used to avoid Object.keys check -// Object.keys() check is really expensive -// https://gist.github.com/vigneshshanmugam/c766550ecd02292dcdfbf0bf013b9d3d - -const testKey = "Expression"; - -const typeSymbols = t => { - // don't recompute - if (types[testKey] !== undefined) { - return types; - } - - t.TYPES.forEach(type => { - types[type] = Symbol.for(type); - }); - return types; -}; - -const isNodeOfType = (t, node, typeSymbol) => typeof typeSymbol !== "symbol" ? false : t["is" + Symbol.keyFor(typeSymbol)](node); - -const isPatternMatchesPath = t => function _isPatternMatchesPath(patternValue, inputPath) { - if (Array.isArray(patternValue)) { - for (let i = 0; i < patternValue.length; i++) { - if (_isPatternMatchesPath(patternValue[i], inputPath)) { - return true; - } - } - - return false; - } - - if (typeof patternValue === "function") { - return patternValue(inputPath); - } - - if (isNodeOfType(t, inputPath.node, patternValue)) return true; - const evalResult = evaluate(inputPath); - if (!evalResult.confident || !inputPath.isPure()) return false; - return evalResult.value === patternValue; -}; - -module.exports = { - VOID_0, - // Types as Symbols - typeSymbols, - // This is required for resolving type aliases - isNodeOfType, - isPatternMatchesPath -};
\ No newline at end of file |
