Download Goat-Bot-V2/node_modules/@babel/generator/lib/node/index.js from sweet2004/mitaaaa: direct link, hf CLI and curl.
- Browser
- Download file 2.22 kB
-
https://huggingface.co/spaces/sweet2004/mitaaaa/resolve/main/Goat-Bot-V2/node_modules/%40babel/generator/lib/node/index.js
- Command line
-
hf download hf://spaces/sweet2004/mitaaaa/Goat-Bot-V2/node_modules/@babel/generator/lib/node/index.js
-
curl -L -o index.js https://huggingface.co/spaces/sweet2004/mitaaaa/resolve/main/Goat-Bot-V2/node_modules/%40babel/generator/lib/node/index.js
2.22 kB
| ; | |
| Object.defineProperty(exports, "__esModule", { | |
| value: true | |
| }); | |
| exports.needsParens = needsParens; | |
| exports.needsWhitespace = needsWhitespace; | |
| exports.needsWhitespaceAfter = needsWhitespaceAfter; | |
| exports.needsWhitespaceBefore = needsWhitespaceBefore; | |
| var whitespace = require("./whitespace"); | |
| var parens = require("./parentheses"); | |
| var _t = require("@babel/types"); | |
| const { | |
| FLIPPED_ALIAS_KEYS, | |
| isCallExpression, | |
| isExpressionStatement, | |
| isMemberExpression, | |
| isNewExpression | |
| } = _t; | |
| function expandAliases(obj) { | |
| const newObj = {}; | |
| function add(type, func) { | |
| const fn = newObj[type]; | |
| newObj[type] = fn ? function (node, parent, stack) { | |
| const result = fn(node, parent, stack); | |
| return result == null ? func(node, parent, stack) : result; | |
| } : func; | |
| } | |
| for (const type of Object.keys(obj)) { | |
| const aliases = FLIPPED_ALIAS_KEYS[type]; | |
| if (aliases) { | |
| for (const alias of aliases) { | |
| add(alias, obj[type]); | |
| } | |
| } else { | |
| add(type, obj[type]); | |
| } | |
| } | |
| return newObj; | |
| } | |
| const expandedParens = expandAliases(parens); | |
| const expandedWhitespaceNodes = expandAliases(whitespace.nodes); | |
| function find(obj, node, parent, printStack) { | |
| const fn = obj[node.type]; | |
| return fn ? fn(node, parent, printStack) : null; | |
| } | |
| function isOrHasCallExpression(node) { | |
| if (isCallExpression(node)) { | |
| return true; | |
| } | |
| return isMemberExpression(node) && isOrHasCallExpression(node.object); | |
| } | |
| function needsWhitespace(node, parent, type) { | |
| if (!node) return false; | |
| if (isExpressionStatement(node)) { | |
| node = node.expression; | |
| } | |
| const flag = find(expandedWhitespaceNodes, node, parent); | |
| if (typeof flag === "number") { | |
| return (flag & type) !== 0; | |
| } | |
| return false; | |
| } | |
| function needsWhitespaceBefore(node, parent) { | |
| return needsWhitespace(node, parent, 1); | |
| } | |
| function needsWhitespaceAfter(node, parent) { | |
| return needsWhitespace(node, parent, 2); | |
| } | |
| function needsParens(node, parent, printStack) { | |
| if (!parent) return false; | |
| if (isNewExpression(parent) && parent.callee === node) { | |
| if (isOrHasCallExpression(node)) return true; | |
| } | |
| return find(expandedParens, node, parent, printStack); | |
| } | |
| //# sourceMappingURL=index.js.map | |