|
Last change
on this file was 9af201e, checked in by MBK <marija.karapandzova@…>, 2 weeks ago |
|
Fix frontend appearance
|
-
Property mode
set to
100644
|
|
File size:
1.2 KB
|
| Line | |
|---|
| 1 | "use strict";
|
|---|
| 2 |
|
|---|
| 3 | Object.defineProperty(exports, "__esModule", {
|
|---|
| 4 | value: true
|
|---|
| 5 | });
|
|---|
| 6 | exports["default"] = void 0;
|
|---|
| 7 | var _jsxAstUtils = require("jsx-ast-utils");
|
|---|
| 8 | /**
|
|---|
| 9 | * Returns true if all items in baseAttributes are found in attributes. Always
|
|---|
| 10 | * returns true if baseAttributes is empty.
|
|---|
| 11 | */
|
|---|
| 12 | function attributesComparator() {
|
|---|
| 13 | var baseAttributes = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|---|
| 14 | var attributes = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
|
|---|
| 15 | return baseAttributes.every(function (baseAttr) {
|
|---|
| 16 | return attributes.some(function (attribute) {
|
|---|
| 17 | // Guard against non-JSXAttribute nodes like JSXSpreadAttribute
|
|---|
| 18 | if (attribute.type !== 'JSXAttribute') {
|
|---|
| 19 | return false;
|
|---|
| 20 | }
|
|---|
| 21 | // Attribute matches.
|
|---|
| 22 | if (baseAttr.name !== (0, _jsxAstUtils.propName)(attribute)) {
|
|---|
| 23 | return false;
|
|---|
| 24 | }
|
|---|
| 25 | // Value exists and does not match.
|
|---|
| 26 | if (baseAttr.value && baseAttr.value !== (0, _jsxAstUtils.getLiteralPropValue)(attribute)) {
|
|---|
| 27 | return false;
|
|---|
| 28 | }
|
|---|
| 29 | return true;
|
|---|
| 30 | });
|
|---|
| 31 | });
|
|---|
| 32 | }
|
|---|
| 33 | var _default = exports["default"] = attributesComparator;
|
|---|
| 34 | module.exports = exports.default; |
|---|
Note:
See
TracBrowser
for help on using the repository browser.