c34bfd63cfa6c62374beb82617c943f21db52bc24ce870f092fd493611defac14222932da82d00260c537856b3da155243cd94684d1c6a92655f14cb4c9396 769 B

123456789101112131415161718192021222324252627
  1. "use strict";
  2. Object.defineProperty(exports, "__esModule", {
  3. value: true
  4. });
  5. exports.default = is;
  6. var _shallowEqual = require("../utils/shallowEqual.js");
  7. var _isType = require("./isType.js");
  8. var _isPlaceholderType = require("./isPlaceholderType.js");
  9. var _index = require("../definitions/index.js");
  10. function is(type, node, opts) {
  11. if (!node) return false;
  12. const matches = (0, _isType.default)(node.type, type);
  13. if (!matches) {
  14. if (!opts && node.type === "Placeholder" && type in _index.FLIPPED_ALIAS_KEYS) {
  15. return (0, _isPlaceholderType.default)(node.expectedNode, type);
  16. }
  17. return false;
  18. }
  19. if (opts === undefined) {
  20. return true;
  21. } else {
  22. return (0, _shallowEqual.default)(node, opts);
  23. }
  24. }
  25. //# sourceMappingURL=is.js.map