UNPKG

993 BJavaScriptView Raw
1"use strict";
2
3Object.defineProperty(exports, "__esModule", {
4 value: true
5});
6exports.default = void 0;
7
8var _optionsDefaults = _interopRequireDefault(require("./schemas/optionsDefaults"));
9
10function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
11
12const 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
37var _default = attributeNameExists;
38exports.default = _default;
39//# sourceMappingURL=attributeNameExists.js.map
\No newline at end of file