1 | "use strict";
|
2 |
|
3 | Object.defineProperty(exports, "__esModule", {
|
4 | value: true
|
5 | });
|
6 | exports.default = void 0;
|
7 |
|
8 | var _optionsDefaults = _interopRequireDefault(require("./schemas/optionsDefaults"));
|
9 |
|
10 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
11 |
|
12 | const attributeNameExists = (programPath, stats) => {
|
13 | let exists = false;
|
14 | let attributeNames = _optionsDefaults.default.attributeNames;
|
15 |
|
16 | if (stats.opts && stats.opts.attributeNames) {
|
17 | attributeNames = Object.assign({}, attributeNames, stats.opts.attributeNames);
|
18 | }
|
19 |
|
20 | programPath.traverse({
|
21 | JSXAttribute(attrPath) {
|
22 | if (exists) {
|
23 | return;
|
24 | }
|
25 |
|
26 | const attribute = attrPath.node;
|
27 |
|
28 | if (typeof attribute.name !== 'undefined' && typeof attributeNames[attribute.name.name] === 'string') {
|
29 | exists = true;
|
30 | }
|
31 | }
|
32 |
|
33 | });
|
34 | return exists;
|
35 | };
|
36 |
|
37 | var _default = attributeNameExists;
|
38 | exports.default = _default;
|
39 |
|
\ | No newline at end of file |