GoScrobble/web/node_modules/@svgr/babel-plugin-remove-jsx-attribute/lib/index.js

23 lines
515 B
JavaScript
Raw Permalink Normal View History

2022-04-25 02:47:15 +00:00
"use strict";
exports.__esModule = true;
exports.default = void 0;
const removeJSXAttribute = (api, opts) => ({
visitor: {
JSXOpeningElement(path) {
if (!opts.elements.includes(path.node.name.name)) return;
path.get('attributes').forEach(attribute => {
const nodeName = attribute.node.name;
if (nodeName && opts.attributes.includes(nodeName.name)) {
attribute.remove();
}
});
}
}
});
var _default = removeJSXAttribute;
exports.default = _default;