1 | "use strict";
|
2 |
|
3 | exports.__esModule = true;
|
4 | exports.default = normalizeAttrs;
|
5 |
|
6 | var t = _interopRequireWildcard(require("@babel/types"));
|
7 |
|
8 | function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }
|
9 |
|
10 | function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; if (obj != null) { var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
11 |
|
12 | function normalizeAttrs(node) {
|
13 | if (!node) return t.NullLiteral();
|
14 | if (!t.isObjectExpression(node)) return node;
|
15 | const {
|
16 | properties
|
17 | } = node;
|
18 | const propsIdent = t.Identifier('props');
|
19 | return t.ArrowFunctionExpression([propsIdent], t.ObjectExpression([t.SpreadElement(propsIdent), ...properties]));
|
20 | } |
\ | No newline at end of file |