"use strict";

var _getOptions = _interopRequireDefault(require("./getOptions"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

let options = (0, _getOptions.default)();
let {
  app: {
    attrbuteNames
  }
} = options;

module.exports = () => ({
  visitor: {
    Program(path, state) {
      let properties = state.opts.properties || [];

      if (properties.length === 0) {
        properties = properties.concat(attrbuteNames);
      }

      path.traverse({
        JSXIdentifier(path2) {
          if (properties.indexOf(path2.node.name.toLowerCase()) > -1) {
            path2.parentPath.remove();
          }
        }

      });
    }

  }
});