Last change
on this file since 6c1585f was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago |
initial commit
|
-
Property mode
set to
100644
|
File size:
747 bytes
|
Rev | Line | |
---|
[6a3a178] | 1 | "use strict";
|
---|
| 2 |
|
---|
| 3 | Object.defineProperty(exports, "__esModule", {
|
---|
| 4 | value: true
|
---|
| 5 | });
|
---|
| 6 | exports.default = is;
|
---|
| 7 |
|
---|
| 8 | var _shallowEqual = require("../utils/shallowEqual");
|
---|
| 9 |
|
---|
| 10 | var _isType = require("./isType");
|
---|
| 11 |
|
---|
| 12 | var _isPlaceholderType = require("./isPlaceholderType");
|
---|
| 13 |
|
---|
| 14 | var _definitions = require("../definitions");
|
---|
| 15 |
|
---|
| 16 | function is(type, node, opts) {
|
---|
| 17 | if (!node) return false;
|
---|
| 18 | const matches = (0, _isType.default)(node.type, type);
|
---|
| 19 |
|
---|
| 20 | if (!matches) {
|
---|
| 21 | if (!opts && node.type === "Placeholder" && type in _definitions.FLIPPED_ALIAS_KEYS) {
|
---|
| 22 | return (0, _isPlaceholderType.default)(node.expectedNode, type);
|
---|
| 23 | }
|
---|
| 24 |
|
---|
| 25 | return false;
|
---|
| 26 | }
|
---|
| 27 |
|
---|
| 28 | if (typeof opts === "undefined") {
|
---|
| 29 | return true;
|
---|
| 30 | } else {
|
---|
| 31 | return (0, _shallowEqual.default)(node, opts);
|
---|
| 32 | }
|
---|
| 33 | } |
---|
Note:
See
TracBrowser
for help on using the repository browser.