|
Last change
on this file was 9af201e, checked in by MBK <marija.karapandzova@…>, 13 days ago |
|
Fix frontend appearance
|
-
Property mode
set to
100644
|
|
File size:
1.3 KB
|
| Line | |
|---|
| 1 | "use strict";
|
|---|
| 2 |
|
|---|
| 3 | Object.defineProperty(exports, "__esModule", {
|
|---|
| 4 | value: true
|
|---|
| 5 | });
|
|---|
| 6 | exports.isPathSimpleArrayWithLength = isPathSimpleArrayWithLength;
|
|---|
| 7 | exports.shouldTransform = shouldTransform;
|
|---|
| 8 | var _helperSkipTransparentExpressionWrappers = require("@babel/helper-skip-transparent-expression-wrappers");
|
|---|
| 9 | function isPathSimpleArrayWithLength(path, N) {
|
|---|
| 10 | var _path$node$extra;
|
|---|
| 11 | if (!path.isArrayExpression()) {
|
|---|
| 12 | return false;
|
|---|
| 13 | }
|
|---|
| 14 | const elementPaths = path.get("elements");
|
|---|
| 15 | return elementPaths.length === N && elementPaths.every(elementPath => elementPath.node && !elementPath.isSpreadElement()) && !((_path$node$extra = path.node.extra) != null && _path$node$extra.trailingComma);
|
|---|
| 16 | }
|
|---|
| 17 | function shouldTransform(path) {
|
|---|
| 18 | const elementPaths = path.get("elements");
|
|---|
| 19 | const elementPathsLength = elementPaths.length;
|
|---|
| 20 | if (elementPaths[elementPathsLength - 1].isRestElement()) {
|
|---|
| 21 | const {
|
|---|
| 22 | parentPath
|
|---|
| 23 | } = path;
|
|---|
| 24 | const rhsPath = parentPath.isVariableDeclarator() ? parentPath.get("init") : parentPath.isAssignmentExpression() ? parentPath.get("right") : null;
|
|---|
| 25 | if (rhsPath != null && rhsPath.node && isPathSimpleArrayWithLength((0, _helperSkipTransparentExpressionWrappers.skipTransparentExprWrappers)(rhsPath), elementPathsLength)) {
|
|---|
| 26 | return rhsPath;
|
|---|
| 27 | }
|
|---|
| 28 | }
|
|---|
| 29 | return false;
|
|---|
| 30 | }
|
|---|
| 31 |
|
|---|
| 32 | //# sourceMappingURL=util.js.map
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.