Gazebo_simulation-Frontend/node_modules/.cache/babel-loader/71b3160573fcaab1d45e2b669fa6a45c.json
2020-12-31 20:18:50 +00:00

1 line
2.1 KiB
JSON

{"ast":null,"code":"\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.default = cloneNode;\n\nvar _definitions = require(\"../definitions\");\n\nvar has = Function.call.bind(Object.prototype.hasOwnProperty);\n\nfunction cloneIfNode(obj, deep) {\n if (obj && typeof obj.type === \"string\" && obj.type !== \"CommentLine\" && obj.type !== \"CommentBlock\") {\n return cloneNode(obj, deep);\n }\n\n return obj;\n}\n\nfunction cloneIfNodeOrArray(obj, deep) {\n if (Array.isArray(obj)) {\n return obj.map(function (node) {\n return cloneIfNode(node, deep);\n });\n }\n\n return cloneIfNode(obj, deep);\n}\n\nfunction cloneNode(node) {\n var deep = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;\n if (!node) return node;\n var type = node.type;\n var newNode = {\n type: type\n };\n\n if (type === \"Identifier\") {\n newNode.name = node.name;\n\n if (has(node, \"optional\") && typeof node.optional === \"boolean\") {\n newNode.optional = node.optional;\n }\n\n if (has(node, \"typeAnnotation\")) {\n newNode.typeAnnotation = deep ? cloneIfNodeOrArray(node.typeAnnotation, true) : node.typeAnnotation;\n }\n } else if (!has(_definitions.NODE_FIELDS, type)) {\n throw new Error(\"Unknown node type: \\\"\".concat(type, \"\\\"\"));\n } else {\n for (var _i = 0, _Object$keys = Object.keys(_definitions.NODE_FIELDS[type]); _i < _Object$keys.length; _i++) {\n var field = _Object$keys[_i];\n\n if (has(node, field)) {\n newNode[field] = deep ? cloneIfNodeOrArray(node[field], true) : node[field];\n }\n }\n }\n\n if (has(node, \"loc\")) {\n newNode.loc = node.loc;\n }\n\n if (has(node, \"leadingComments\")) {\n newNode.leadingComments = node.leadingComments;\n }\n\n if (has(node, \"innerComments\")) {\n newNode.innerComments = node.innerComments;\n }\n\n if (has(node, \"trailingComments\")) {\n newNode.trailingComments = node.trailingComments;\n }\n\n if (has(node, \"extra\")) {\n newNode.extra = Object.assign({}, node.extra);\n }\n\n return newNode;\n}","map":null,"metadata":{},"sourceType":"script"}