Sha256: af4719777970692f5a17a549a585eeb93c604cdd7697da3816deb52add4cee11
Contents?: true
Size: 997 Bytes
Versions: 161
Compression:
Stored size: 997 Bytes
Contents
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.default = void 0; var _index = require("../validators/generated/index.js"); var _index2 = require("../builders/generated/index.js"); var _default = exports.default = toStatement; function toStatement(node, ignore) { if ((0, _index.isStatement)(node)) { return node; } let mustHaveId = false; let newType; if ((0, _index.isClass)(node)) { mustHaveId = true; newType = "ClassDeclaration"; } else if ((0, _index.isFunction)(node)) { mustHaveId = true; newType = "FunctionDeclaration"; } else if ((0, _index.isAssignmentExpression)(node)) { return (0, _index2.expressionStatement)(node); } if (mustHaveId && !node.id) { newType = false; } if (!newType) { if (ignore) { return false; } else { throw new Error(`cannot turn ${node.type} to a statement`); } } node.type = newType; return node; } //# sourceMappingURL=toStatement.js.map
Version data entries
161 entries across 15 versions & 2 rubygems