1 | "use strict";
|
---|
2 |
|
---|
3 | Object.defineProperty(exports, "__esModule", {
|
---|
4 | value: true
|
---|
5 | });
|
---|
6 | exports.isArrayExpression = isArrayExpression;
|
---|
7 | exports.isAssignmentExpression = isAssignmentExpression;
|
---|
8 | exports.isBinaryExpression = isBinaryExpression;
|
---|
9 | exports.isInterpreterDirective = isInterpreterDirective;
|
---|
10 | exports.isDirective = isDirective;
|
---|
11 | exports.isDirectiveLiteral = isDirectiveLiteral;
|
---|
12 | exports.isBlockStatement = isBlockStatement;
|
---|
13 | exports.isBreakStatement = isBreakStatement;
|
---|
14 | exports.isCallExpression = isCallExpression;
|
---|
15 | exports.isCatchClause = isCatchClause;
|
---|
16 | exports.isConditionalExpression = isConditionalExpression;
|
---|
17 | exports.isContinueStatement = isContinueStatement;
|
---|
18 | exports.isDebuggerStatement = isDebuggerStatement;
|
---|
19 | exports.isDoWhileStatement = isDoWhileStatement;
|
---|
20 | exports.isEmptyStatement = isEmptyStatement;
|
---|
21 | exports.isExpressionStatement = isExpressionStatement;
|
---|
22 | exports.isFile = isFile;
|
---|
23 | exports.isForInStatement = isForInStatement;
|
---|
24 | exports.isForStatement = isForStatement;
|
---|
25 | exports.isFunctionDeclaration = isFunctionDeclaration;
|
---|
26 | exports.isFunctionExpression = isFunctionExpression;
|
---|
27 | exports.isIdentifier = isIdentifier;
|
---|
28 | exports.isIfStatement = isIfStatement;
|
---|
29 | exports.isLabeledStatement = isLabeledStatement;
|
---|
30 | exports.isStringLiteral = isStringLiteral;
|
---|
31 | exports.isNumericLiteral = isNumericLiteral;
|
---|
32 | exports.isNullLiteral = isNullLiteral;
|
---|
33 | exports.isBooleanLiteral = isBooleanLiteral;
|
---|
34 | exports.isRegExpLiteral = isRegExpLiteral;
|
---|
35 | exports.isLogicalExpression = isLogicalExpression;
|
---|
36 | exports.isMemberExpression = isMemberExpression;
|
---|
37 | exports.isNewExpression = isNewExpression;
|
---|
38 | exports.isProgram = isProgram;
|
---|
39 | exports.isObjectExpression = isObjectExpression;
|
---|
40 | exports.isObjectMethod = isObjectMethod;
|
---|
41 | exports.isObjectProperty = isObjectProperty;
|
---|
42 | exports.isRestElement = isRestElement;
|
---|
43 | exports.isReturnStatement = isReturnStatement;
|
---|
44 | exports.isSequenceExpression = isSequenceExpression;
|
---|
45 | exports.isParenthesizedExpression = isParenthesizedExpression;
|
---|
46 | exports.isSwitchCase = isSwitchCase;
|
---|
47 | exports.isSwitchStatement = isSwitchStatement;
|
---|
48 | exports.isThisExpression = isThisExpression;
|
---|
49 | exports.isThrowStatement = isThrowStatement;
|
---|
50 | exports.isTryStatement = isTryStatement;
|
---|
51 | exports.isUnaryExpression = isUnaryExpression;
|
---|
52 | exports.isUpdateExpression = isUpdateExpression;
|
---|
53 | exports.isVariableDeclaration = isVariableDeclaration;
|
---|
54 | exports.isVariableDeclarator = isVariableDeclarator;
|
---|
55 | exports.isWhileStatement = isWhileStatement;
|
---|
56 | exports.isWithStatement = isWithStatement;
|
---|
57 | exports.isAssignmentPattern = isAssignmentPattern;
|
---|
58 | exports.isArrayPattern = isArrayPattern;
|
---|
59 | exports.isArrowFunctionExpression = isArrowFunctionExpression;
|
---|
60 | exports.isClassBody = isClassBody;
|
---|
61 | exports.isClassExpression = isClassExpression;
|
---|
62 | exports.isClassDeclaration = isClassDeclaration;
|
---|
63 | exports.isExportAllDeclaration = isExportAllDeclaration;
|
---|
64 | exports.isExportDefaultDeclaration = isExportDefaultDeclaration;
|
---|
65 | exports.isExportNamedDeclaration = isExportNamedDeclaration;
|
---|
66 | exports.isExportSpecifier = isExportSpecifier;
|
---|
67 | exports.isForOfStatement = isForOfStatement;
|
---|
68 | exports.isImportDeclaration = isImportDeclaration;
|
---|
69 | exports.isImportDefaultSpecifier = isImportDefaultSpecifier;
|
---|
70 | exports.isImportNamespaceSpecifier = isImportNamespaceSpecifier;
|
---|
71 | exports.isImportSpecifier = isImportSpecifier;
|
---|
72 | exports.isMetaProperty = isMetaProperty;
|
---|
73 | exports.isClassMethod = isClassMethod;
|
---|
74 | exports.isObjectPattern = isObjectPattern;
|
---|
75 | exports.isSpreadElement = isSpreadElement;
|
---|
76 | exports.isSuper = isSuper;
|
---|
77 | exports.isTaggedTemplateExpression = isTaggedTemplateExpression;
|
---|
78 | exports.isTemplateElement = isTemplateElement;
|
---|
79 | exports.isTemplateLiteral = isTemplateLiteral;
|
---|
80 | exports.isYieldExpression = isYieldExpression;
|
---|
81 | exports.isAwaitExpression = isAwaitExpression;
|
---|
82 | exports.isImport = isImport;
|
---|
83 | exports.isBigIntLiteral = isBigIntLiteral;
|
---|
84 | exports.isExportNamespaceSpecifier = isExportNamespaceSpecifier;
|
---|
85 | exports.isOptionalMemberExpression = isOptionalMemberExpression;
|
---|
86 | exports.isOptionalCallExpression = isOptionalCallExpression;
|
---|
87 | exports.isClassProperty = isClassProperty;
|
---|
88 | exports.isClassPrivateProperty = isClassPrivateProperty;
|
---|
89 | exports.isClassPrivateMethod = isClassPrivateMethod;
|
---|
90 | exports.isPrivateName = isPrivateName;
|
---|
91 | exports.isAnyTypeAnnotation = isAnyTypeAnnotation;
|
---|
92 | exports.isArrayTypeAnnotation = isArrayTypeAnnotation;
|
---|
93 | exports.isBooleanTypeAnnotation = isBooleanTypeAnnotation;
|
---|
94 | exports.isBooleanLiteralTypeAnnotation = isBooleanLiteralTypeAnnotation;
|
---|
95 | exports.isNullLiteralTypeAnnotation = isNullLiteralTypeAnnotation;
|
---|
96 | exports.isClassImplements = isClassImplements;
|
---|
97 | exports.isDeclareClass = isDeclareClass;
|
---|
98 | exports.isDeclareFunction = isDeclareFunction;
|
---|
99 | exports.isDeclareInterface = isDeclareInterface;
|
---|
100 | exports.isDeclareModule = isDeclareModule;
|
---|
101 | exports.isDeclareModuleExports = isDeclareModuleExports;
|
---|
102 | exports.isDeclareTypeAlias = isDeclareTypeAlias;
|
---|
103 | exports.isDeclareOpaqueType = isDeclareOpaqueType;
|
---|
104 | exports.isDeclareVariable = isDeclareVariable;
|
---|
105 | exports.isDeclareExportDeclaration = isDeclareExportDeclaration;
|
---|
106 | exports.isDeclareExportAllDeclaration = isDeclareExportAllDeclaration;
|
---|
107 | exports.isDeclaredPredicate = isDeclaredPredicate;
|
---|
108 | exports.isExistsTypeAnnotation = isExistsTypeAnnotation;
|
---|
109 | exports.isFunctionTypeAnnotation = isFunctionTypeAnnotation;
|
---|
110 | exports.isFunctionTypeParam = isFunctionTypeParam;
|
---|
111 | exports.isGenericTypeAnnotation = isGenericTypeAnnotation;
|
---|
112 | exports.isInferredPredicate = isInferredPredicate;
|
---|
113 | exports.isInterfaceExtends = isInterfaceExtends;
|
---|
114 | exports.isInterfaceDeclaration = isInterfaceDeclaration;
|
---|
115 | exports.isInterfaceTypeAnnotation = isInterfaceTypeAnnotation;
|
---|
116 | exports.isIntersectionTypeAnnotation = isIntersectionTypeAnnotation;
|
---|
117 | exports.isMixedTypeAnnotation = isMixedTypeAnnotation;
|
---|
118 | exports.isEmptyTypeAnnotation = isEmptyTypeAnnotation;
|
---|
119 | exports.isNullableTypeAnnotation = isNullableTypeAnnotation;
|
---|
120 | exports.isNumberLiteralTypeAnnotation = isNumberLiteralTypeAnnotation;
|
---|
121 | exports.isNumberTypeAnnotation = isNumberTypeAnnotation;
|
---|
122 | exports.isObjectTypeAnnotation = isObjectTypeAnnotation;
|
---|
123 | exports.isObjectTypeInternalSlot = isObjectTypeInternalSlot;
|
---|
124 | exports.isObjectTypeCallProperty = isObjectTypeCallProperty;
|
---|
125 | exports.isObjectTypeIndexer = isObjectTypeIndexer;
|
---|
126 | exports.isObjectTypeProperty = isObjectTypeProperty;
|
---|
127 | exports.isObjectTypeSpreadProperty = isObjectTypeSpreadProperty;
|
---|
128 | exports.isOpaqueType = isOpaqueType;
|
---|
129 | exports.isQualifiedTypeIdentifier = isQualifiedTypeIdentifier;
|
---|
130 | exports.isStringLiteralTypeAnnotation = isStringLiteralTypeAnnotation;
|
---|
131 | exports.isStringTypeAnnotation = isStringTypeAnnotation;
|
---|
132 | exports.isSymbolTypeAnnotation = isSymbolTypeAnnotation;
|
---|
133 | exports.isThisTypeAnnotation = isThisTypeAnnotation;
|
---|
134 | exports.isTupleTypeAnnotation = isTupleTypeAnnotation;
|
---|
135 | exports.isTypeofTypeAnnotation = isTypeofTypeAnnotation;
|
---|
136 | exports.isTypeAlias = isTypeAlias;
|
---|
137 | exports.isTypeAnnotation = isTypeAnnotation;
|
---|
138 | exports.isTypeCastExpression = isTypeCastExpression;
|
---|
139 | exports.isTypeParameter = isTypeParameter;
|
---|
140 | exports.isTypeParameterDeclaration = isTypeParameterDeclaration;
|
---|
141 | exports.isTypeParameterInstantiation = isTypeParameterInstantiation;
|
---|
142 | exports.isUnionTypeAnnotation = isUnionTypeAnnotation;
|
---|
143 | exports.isVariance = isVariance;
|
---|
144 | exports.isVoidTypeAnnotation = isVoidTypeAnnotation;
|
---|
145 | exports.isEnumDeclaration = isEnumDeclaration;
|
---|
146 | exports.isEnumBooleanBody = isEnumBooleanBody;
|
---|
147 | exports.isEnumNumberBody = isEnumNumberBody;
|
---|
148 | exports.isEnumStringBody = isEnumStringBody;
|
---|
149 | exports.isEnumSymbolBody = isEnumSymbolBody;
|
---|
150 | exports.isEnumBooleanMember = isEnumBooleanMember;
|
---|
151 | exports.isEnumNumberMember = isEnumNumberMember;
|
---|
152 | exports.isEnumStringMember = isEnumStringMember;
|
---|
153 | exports.isEnumDefaultedMember = isEnumDefaultedMember;
|
---|
154 | exports.isIndexedAccessType = isIndexedAccessType;
|
---|
155 | exports.isOptionalIndexedAccessType = isOptionalIndexedAccessType;
|
---|
156 | exports.isJSXAttribute = isJSXAttribute;
|
---|
157 | exports.isJSXClosingElement = isJSXClosingElement;
|
---|
158 | exports.isJSXElement = isJSXElement;
|
---|
159 | exports.isJSXEmptyExpression = isJSXEmptyExpression;
|
---|
160 | exports.isJSXExpressionContainer = isJSXExpressionContainer;
|
---|
161 | exports.isJSXSpreadChild = isJSXSpreadChild;
|
---|
162 | exports.isJSXIdentifier = isJSXIdentifier;
|
---|
163 | exports.isJSXMemberExpression = isJSXMemberExpression;
|
---|
164 | exports.isJSXNamespacedName = isJSXNamespacedName;
|
---|
165 | exports.isJSXOpeningElement = isJSXOpeningElement;
|
---|
166 | exports.isJSXSpreadAttribute = isJSXSpreadAttribute;
|
---|
167 | exports.isJSXText = isJSXText;
|
---|
168 | exports.isJSXFragment = isJSXFragment;
|
---|
169 | exports.isJSXOpeningFragment = isJSXOpeningFragment;
|
---|
170 | exports.isJSXClosingFragment = isJSXClosingFragment;
|
---|
171 | exports.isNoop = isNoop;
|
---|
172 | exports.isPlaceholder = isPlaceholder;
|
---|
173 | exports.isV8IntrinsicIdentifier = isV8IntrinsicIdentifier;
|
---|
174 | exports.isArgumentPlaceholder = isArgumentPlaceholder;
|
---|
175 | exports.isBindExpression = isBindExpression;
|
---|
176 | exports.isImportAttribute = isImportAttribute;
|
---|
177 | exports.isDecorator = isDecorator;
|
---|
178 | exports.isDoExpression = isDoExpression;
|
---|
179 | exports.isExportDefaultSpecifier = isExportDefaultSpecifier;
|
---|
180 | exports.isRecordExpression = isRecordExpression;
|
---|
181 | exports.isTupleExpression = isTupleExpression;
|
---|
182 | exports.isDecimalLiteral = isDecimalLiteral;
|
---|
183 | exports.isStaticBlock = isStaticBlock;
|
---|
184 | exports.isModuleExpression = isModuleExpression;
|
---|
185 | exports.isTopicReference = isTopicReference;
|
---|
186 | exports.isPipelineTopicExpression = isPipelineTopicExpression;
|
---|
187 | exports.isPipelineBareFunction = isPipelineBareFunction;
|
---|
188 | exports.isPipelinePrimaryTopicReference = isPipelinePrimaryTopicReference;
|
---|
189 | exports.isTSParameterProperty = isTSParameterProperty;
|
---|
190 | exports.isTSDeclareFunction = isTSDeclareFunction;
|
---|
191 | exports.isTSDeclareMethod = isTSDeclareMethod;
|
---|
192 | exports.isTSQualifiedName = isTSQualifiedName;
|
---|
193 | exports.isTSCallSignatureDeclaration = isTSCallSignatureDeclaration;
|
---|
194 | exports.isTSConstructSignatureDeclaration = isTSConstructSignatureDeclaration;
|
---|
195 | exports.isTSPropertySignature = isTSPropertySignature;
|
---|
196 | exports.isTSMethodSignature = isTSMethodSignature;
|
---|
197 | exports.isTSIndexSignature = isTSIndexSignature;
|
---|
198 | exports.isTSAnyKeyword = isTSAnyKeyword;
|
---|
199 | exports.isTSBooleanKeyword = isTSBooleanKeyword;
|
---|
200 | exports.isTSBigIntKeyword = isTSBigIntKeyword;
|
---|
201 | exports.isTSIntrinsicKeyword = isTSIntrinsicKeyword;
|
---|
202 | exports.isTSNeverKeyword = isTSNeverKeyword;
|
---|
203 | exports.isTSNullKeyword = isTSNullKeyword;
|
---|
204 | exports.isTSNumberKeyword = isTSNumberKeyword;
|
---|
205 | exports.isTSObjectKeyword = isTSObjectKeyword;
|
---|
206 | exports.isTSStringKeyword = isTSStringKeyword;
|
---|
207 | exports.isTSSymbolKeyword = isTSSymbolKeyword;
|
---|
208 | exports.isTSUndefinedKeyword = isTSUndefinedKeyword;
|
---|
209 | exports.isTSUnknownKeyword = isTSUnknownKeyword;
|
---|
210 | exports.isTSVoidKeyword = isTSVoidKeyword;
|
---|
211 | exports.isTSThisType = isTSThisType;
|
---|
212 | exports.isTSFunctionType = isTSFunctionType;
|
---|
213 | exports.isTSConstructorType = isTSConstructorType;
|
---|
214 | exports.isTSTypeReference = isTSTypeReference;
|
---|
215 | exports.isTSTypePredicate = isTSTypePredicate;
|
---|
216 | exports.isTSTypeQuery = isTSTypeQuery;
|
---|
217 | exports.isTSTypeLiteral = isTSTypeLiteral;
|
---|
218 | exports.isTSArrayType = isTSArrayType;
|
---|
219 | exports.isTSTupleType = isTSTupleType;
|
---|
220 | exports.isTSOptionalType = isTSOptionalType;
|
---|
221 | exports.isTSRestType = isTSRestType;
|
---|
222 | exports.isTSNamedTupleMember = isTSNamedTupleMember;
|
---|
223 | exports.isTSUnionType = isTSUnionType;
|
---|
224 | exports.isTSIntersectionType = isTSIntersectionType;
|
---|
225 | exports.isTSConditionalType = isTSConditionalType;
|
---|
226 | exports.isTSInferType = isTSInferType;
|
---|
227 | exports.isTSParenthesizedType = isTSParenthesizedType;
|
---|
228 | exports.isTSTypeOperator = isTSTypeOperator;
|
---|
229 | exports.isTSIndexedAccessType = isTSIndexedAccessType;
|
---|
230 | exports.isTSMappedType = isTSMappedType;
|
---|
231 | exports.isTSLiteralType = isTSLiteralType;
|
---|
232 | exports.isTSExpressionWithTypeArguments = isTSExpressionWithTypeArguments;
|
---|
233 | exports.isTSInterfaceDeclaration = isTSInterfaceDeclaration;
|
---|
234 | exports.isTSInterfaceBody = isTSInterfaceBody;
|
---|
235 | exports.isTSTypeAliasDeclaration = isTSTypeAliasDeclaration;
|
---|
236 | exports.isTSAsExpression = isTSAsExpression;
|
---|
237 | exports.isTSTypeAssertion = isTSTypeAssertion;
|
---|
238 | exports.isTSEnumDeclaration = isTSEnumDeclaration;
|
---|
239 | exports.isTSEnumMember = isTSEnumMember;
|
---|
240 | exports.isTSModuleDeclaration = isTSModuleDeclaration;
|
---|
241 | exports.isTSModuleBlock = isTSModuleBlock;
|
---|
242 | exports.isTSImportType = isTSImportType;
|
---|
243 | exports.isTSImportEqualsDeclaration = isTSImportEqualsDeclaration;
|
---|
244 | exports.isTSExternalModuleReference = isTSExternalModuleReference;
|
---|
245 | exports.isTSNonNullExpression = isTSNonNullExpression;
|
---|
246 | exports.isTSExportAssignment = isTSExportAssignment;
|
---|
247 | exports.isTSNamespaceExportDeclaration = isTSNamespaceExportDeclaration;
|
---|
248 | exports.isTSTypeAnnotation = isTSTypeAnnotation;
|
---|
249 | exports.isTSTypeParameterInstantiation = isTSTypeParameterInstantiation;
|
---|
250 | exports.isTSTypeParameterDeclaration = isTSTypeParameterDeclaration;
|
---|
251 | exports.isTSTypeParameter = isTSTypeParameter;
|
---|
252 | exports.isExpression = isExpression;
|
---|
253 | exports.isBinary = isBinary;
|
---|
254 | exports.isScopable = isScopable;
|
---|
255 | exports.isBlockParent = isBlockParent;
|
---|
256 | exports.isBlock = isBlock;
|
---|
257 | exports.isStatement = isStatement;
|
---|
258 | exports.isTerminatorless = isTerminatorless;
|
---|
259 | exports.isCompletionStatement = isCompletionStatement;
|
---|
260 | exports.isConditional = isConditional;
|
---|
261 | exports.isLoop = isLoop;
|
---|
262 | exports.isWhile = isWhile;
|
---|
263 | exports.isExpressionWrapper = isExpressionWrapper;
|
---|
264 | exports.isFor = isFor;
|
---|
265 | exports.isForXStatement = isForXStatement;
|
---|
266 | exports.isFunction = isFunction;
|
---|
267 | exports.isFunctionParent = isFunctionParent;
|
---|
268 | exports.isPureish = isPureish;
|
---|
269 | exports.isDeclaration = isDeclaration;
|
---|
270 | exports.isPatternLike = isPatternLike;
|
---|
271 | exports.isLVal = isLVal;
|
---|
272 | exports.isTSEntityName = isTSEntityName;
|
---|
273 | exports.isLiteral = isLiteral;
|
---|
274 | exports.isImmutable = isImmutable;
|
---|
275 | exports.isUserWhitespacable = isUserWhitespacable;
|
---|
276 | exports.isMethod = isMethod;
|
---|
277 | exports.isObjectMember = isObjectMember;
|
---|
278 | exports.isProperty = isProperty;
|
---|
279 | exports.isUnaryLike = isUnaryLike;
|
---|
280 | exports.isPattern = isPattern;
|
---|
281 | exports.isClass = isClass;
|
---|
282 | exports.isModuleDeclaration = isModuleDeclaration;
|
---|
283 | exports.isExportDeclaration = isExportDeclaration;
|
---|
284 | exports.isModuleSpecifier = isModuleSpecifier;
|
---|
285 | exports.isPrivate = isPrivate;
|
---|
286 | exports.isFlow = isFlow;
|
---|
287 | exports.isFlowType = isFlowType;
|
---|
288 | exports.isFlowBaseAnnotation = isFlowBaseAnnotation;
|
---|
289 | exports.isFlowDeclaration = isFlowDeclaration;
|
---|
290 | exports.isFlowPredicate = isFlowPredicate;
|
---|
291 | exports.isEnumBody = isEnumBody;
|
---|
292 | exports.isEnumMember = isEnumMember;
|
---|
293 | exports.isJSX = isJSX;
|
---|
294 | exports.isTSTypeElement = isTSTypeElement;
|
---|
295 | exports.isTSType = isTSType;
|
---|
296 | exports.isTSBaseType = isTSBaseType;
|
---|
297 | exports.isNumberLiteral = isNumberLiteral;
|
---|
298 | exports.isRegexLiteral = isRegexLiteral;
|
---|
299 | exports.isRestProperty = isRestProperty;
|
---|
300 | exports.isSpreadProperty = isSpreadProperty;
|
---|
301 |
|
---|
302 | var _shallowEqual = require("../../utils/shallowEqual");
|
---|
303 |
|
---|
304 | function isArrayExpression(node, opts) {
|
---|
305 | if (!node) return false;
|
---|
306 | const nodeType = node.type;
|
---|
307 |
|
---|
308 | if (nodeType === "ArrayExpression") {
|
---|
309 | if (typeof opts === "undefined") {
|
---|
310 | return true;
|
---|
311 | } else {
|
---|
312 | return (0, _shallowEqual.default)(node, opts);
|
---|
313 | }
|
---|
314 | }
|
---|
315 |
|
---|
316 | return false;
|
---|
317 | }
|
---|
318 |
|
---|
319 | function isAssignmentExpression(node, opts) {
|
---|
320 | if (!node) return false;
|
---|
321 | const nodeType = node.type;
|
---|
322 |
|
---|
323 | if (nodeType === "AssignmentExpression") {
|
---|
324 | if (typeof opts === "undefined") {
|
---|
325 | return true;
|
---|
326 | } else {
|
---|
327 | return (0, _shallowEqual.default)(node, opts);
|
---|
328 | }
|
---|
329 | }
|
---|
330 |
|
---|
331 | return false;
|
---|
332 | }
|
---|
333 |
|
---|
334 | function isBinaryExpression(node, opts) {
|
---|
335 | if (!node) return false;
|
---|
336 | const nodeType = node.type;
|
---|
337 |
|
---|
338 | if (nodeType === "BinaryExpression") {
|
---|
339 | if (typeof opts === "undefined") {
|
---|
340 | return true;
|
---|
341 | } else {
|
---|
342 | return (0, _shallowEqual.default)(node, opts);
|
---|
343 | }
|
---|
344 | }
|
---|
345 |
|
---|
346 | return false;
|
---|
347 | }
|
---|
348 |
|
---|
349 | function isInterpreterDirective(node, opts) {
|
---|
350 | if (!node) return false;
|
---|
351 | const nodeType = node.type;
|
---|
352 |
|
---|
353 | if (nodeType === "InterpreterDirective") {
|
---|
354 | if (typeof opts === "undefined") {
|
---|
355 | return true;
|
---|
356 | } else {
|
---|
357 | return (0, _shallowEqual.default)(node, opts);
|
---|
358 | }
|
---|
359 | }
|
---|
360 |
|
---|
361 | return false;
|
---|
362 | }
|
---|
363 |
|
---|
364 | function isDirective(node, opts) {
|
---|
365 | if (!node) return false;
|
---|
366 | const nodeType = node.type;
|
---|
367 |
|
---|
368 | if (nodeType === "Directive") {
|
---|
369 | if (typeof opts === "undefined") {
|
---|
370 | return true;
|
---|
371 | } else {
|
---|
372 | return (0, _shallowEqual.default)(node, opts);
|
---|
373 | }
|
---|
374 | }
|
---|
375 |
|
---|
376 | return false;
|
---|
377 | }
|
---|
378 |
|
---|
379 | function isDirectiveLiteral(node, opts) {
|
---|
380 | if (!node) return false;
|
---|
381 | const nodeType = node.type;
|
---|
382 |
|
---|
383 | if (nodeType === "DirectiveLiteral") {
|
---|
384 | if (typeof opts === "undefined") {
|
---|
385 | return true;
|
---|
386 | } else {
|
---|
387 | return (0, _shallowEqual.default)(node, opts);
|
---|
388 | }
|
---|
389 | }
|
---|
390 |
|
---|
391 | return false;
|
---|
392 | }
|
---|
393 |
|
---|
394 | function isBlockStatement(node, opts) {
|
---|
395 | if (!node) return false;
|
---|
396 | const nodeType = node.type;
|
---|
397 |
|
---|
398 | if (nodeType === "BlockStatement") {
|
---|
399 | if (typeof opts === "undefined") {
|
---|
400 | return true;
|
---|
401 | } else {
|
---|
402 | return (0, _shallowEqual.default)(node, opts);
|
---|
403 | }
|
---|
404 | }
|
---|
405 |
|
---|
406 | return false;
|
---|
407 | }
|
---|
408 |
|
---|
409 | function isBreakStatement(node, opts) {
|
---|
410 | if (!node) return false;
|
---|
411 | const nodeType = node.type;
|
---|
412 |
|
---|
413 | if (nodeType === "BreakStatement") {
|
---|
414 | if (typeof opts === "undefined") {
|
---|
415 | return true;
|
---|
416 | } else {
|
---|
417 | return (0, _shallowEqual.default)(node, opts);
|
---|
418 | }
|
---|
419 | }
|
---|
420 |
|
---|
421 | return false;
|
---|
422 | }
|
---|
423 |
|
---|
424 | function isCallExpression(node, opts) {
|
---|
425 | if (!node) return false;
|
---|
426 | const nodeType = node.type;
|
---|
427 |
|
---|
428 | if (nodeType === "CallExpression") {
|
---|
429 | if (typeof opts === "undefined") {
|
---|
430 | return true;
|
---|
431 | } else {
|
---|
432 | return (0, _shallowEqual.default)(node, opts);
|
---|
433 | }
|
---|
434 | }
|
---|
435 |
|
---|
436 | return false;
|
---|
437 | }
|
---|
438 |
|
---|
439 | function isCatchClause(node, opts) {
|
---|
440 | if (!node) return false;
|
---|
441 | const nodeType = node.type;
|
---|
442 |
|
---|
443 | if (nodeType === "CatchClause") {
|
---|
444 | if (typeof opts === "undefined") {
|
---|
445 | return true;
|
---|
446 | } else {
|
---|
447 | return (0, _shallowEqual.default)(node, opts);
|
---|
448 | }
|
---|
449 | }
|
---|
450 |
|
---|
451 | return false;
|
---|
452 | }
|
---|
453 |
|
---|
454 | function isConditionalExpression(node, opts) {
|
---|
455 | if (!node) return false;
|
---|
456 | const nodeType = node.type;
|
---|
457 |
|
---|
458 | if (nodeType === "ConditionalExpression") {
|
---|
459 | if (typeof opts === "undefined") {
|
---|
460 | return true;
|
---|
461 | } else {
|
---|
462 | return (0, _shallowEqual.default)(node, opts);
|
---|
463 | }
|
---|
464 | }
|
---|
465 |
|
---|
466 | return false;
|
---|
467 | }
|
---|
468 |
|
---|
469 | function isContinueStatement(node, opts) {
|
---|
470 | if (!node) return false;
|
---|
471 | const nodeType = node.type;
|
---|
472 |
|
---|
473 | if (nodeType === "ContinueStatement") {
|
---|
474 | if (typeof opts === "undefined") {
|
---|
475 | return true;
|
---|
476 | } else {
|
---|
477 | return (0, _shallowEqual.default)(node, opts);
|
---|
478 | }
|
---|
479 | }
|
---|
480 |
|
---|
481 | return false;
|
---|
482 | }
|
---|
483 |
|
---|
484 | function isDebuggerStatement(node, opts) {
|
---|
485 | if (!node) return false;
|
---|
486 | const nodeType = node.type;
|
---|
487 |
|
---|
488 | if (nodeType === "DebuggerStatement") {
|
---|
489 | if (typeof opts === "undefined") {
|
---|
490 | return true;
|
---|
491 | } else {
|
---|
492 | return (0, _shallowEqual.default)(node, opts);
|
---|
493 | }
|
---|
494 | }
|
---|
495 |
|
---|
496 | return false;
|
---|
497 | }
|
---|
498 |
|
---|
499 | function isDoWhileStatement(node, opts) {
|
---|
500 | if (!node) return false;
|
---|
501 | const nodeType = node.type;
|
---|
502 |
|
---|
503 | if (nodeType === "DoWhileStatement") {
|
---|
504 | if (typeof opts === "undefined") {
|
---|
505 | return true;
|
---|
506 | } else {
|
---|
507 | return (0, _shallowEqual.default)(node, opts);
|
---|
508 | }
|
---|
509 | }
|
---|
510 |
|
---|
511 | return false;
|
---|
512 | }
|
---|
513 |
|
---|
514 | function isEmptyStatement(node, opts) {
|
---|
515 | if (!node) return false;
|
---|
516 | const nodeType = node.type;
|
---|
517 |
|
---|
518 | if (nodeType === "EmptyStatement") {
|
---|
519 | if (typeof opts === "undefined") {
|
---|
520 | return true;
|
---|
521 | } else {
|
---|
522 | return (0, _shallowEqual.default)(node, opts);
|
---|
523 | }
|
---|
524 | }
|
---|
525 |
|
---|
526 | return false;
|
---|
527 | }
|
---|
528 |
|
---|
529 | function isExpressionStatement(node, opts) {
|
---|
530 | if (!node) return false;
|
---|
531 | const nodeType = node.type;
|
---|
532 |
|
---|
533 | if (nodeType === "ExpressionStatement") {
|
---|
534 | if (typeof opts === "undefined") {
|
---|
535 | return true;
|
---|
536 | } else {
|
---|
537 | return (0, _shallowEqual.default)(node, opts);
|
---|
538 | }
|
---|
539 | }
|
---|
540 |
|
---|
541 | return false;
|
---|
542 | }
|
---|
543 |
|
---|
544 | function isFile(node, opts) {
|
---|
545 | if (!node) return false;
|
---|
546 | const nodeType = node.type;
|
---|
547 |
|
---|
548 | if (nodeType === "File") {
|
---|
549 | if (typeof opts === "undefined") {
|
---|
550 | return true;
|
---|
551 | } else {
|
---|
552 | return (0, _shallowEqual.default)(node, opts);
|
---|
553 | }
|
---|
554 | }
|
---|
555 |
|
---|
556 | return false;
|
---|
557 | }
|
---|
558 |
|
---|
559 | function isForInStatement(node, opts) {
|
---|
560 | if (!node) return false;
|
---|
561 | const nodeType = node.type;
|
---|
562 |
|
---|
563 | if (nodeType === "ForInStatement") {
|
---|
564 | if (typeof opts === "undefined") {
|
---|
565 | return true;
|
---|
566 | } else {
|
---|
567 | return (0, _shallowEqual.default)(node, opts);
|
---|
568 | }
|
---|
569 | }
|
---|
570 |
|
---|
571 | return false;
|
---|
572 | }
|
---|
573 |
|
---|
574 | function isForStatement(node, opts) {
|
---|
575 | if (!node) return false;
|
---|
576 | const nodeType = node.type;
|
---|
577 |
|
---|
578 | if (nodeType === "ForStatement") {
|
---|
579 | if (typeof opts === "undefined") {
|
---|
580 | return true;
|
---|
581 | } else {
|
---|
582 | return (0, _shallowEqual.default)(node, opts);
|
---|
583 | }
|
---|
584 | }
|
---|
585 |
|
---|
586 | return false;
|
---|
587 | }
|
---|
588 |
|
---|
589 | function isFunctionDeclaration(node, opts) {
|
---|
590 | if (!node) return false;
|
---|
591 | const nodeType = node.type;
|
---|
592 |
|
---|
593 | if (nodeType === "FunctionDeclaration") {
|
---|
594 | if (typeof opts === "undefined") {
|
---|
595 | return true;
|
---|
596 | } else {
|
---|
597 | return (0, _shallowEqual.default)(node, opts);
|
---|
598 | }
|
---|
599 | }
|
---|
600 |
|
---|
601 | return false;
|
---|
602 | }
|
---|
603 |
|
---|
604 | function isFunctionExpression(node, opts) {
|
---|
605 | if (!node) return false;
|
---|
606 | const nodeType = node.type;
|
---|
607 |
|
---|
608 | if (nodeType === "FunctionExpression") {
|
---|
609 | if (typeof opts === "undefined") {
|
---|
610 | return true;
|
---|
611 | } else {
|
---|
612 | return (0, _shallowEqual.default)(node, opts);
|
---|
613 | }
|
---|
614 | }
|
---|
615 |
|
---|
616 | return false;
|
---|
617 | }
|
---|
618 |
|
---|
619 | function isIdentifier(node, opts) {
|
---|
620 | if (!node) return false;
|
---|
621 | const nodeType = node.type;
|
---|
622 |
|
---|
623 | if (nodeType === "Identifier") {
|
---|
624 | if (typeof opts === "undefined") {
|
---|
625 | return true;
|
---|
626 | } else {
|
---|
627 | return (0, _shallowEqual.default)(node, opts);
|
---|
628 | }
|
---|
629 | }
|
---|
630 |
|
---|
631 | return false;
|
---|
632 | }
|
---|
633 |
|
---|
634 | function isIfStatement(node, opts) {
|
---|
635 | if (!node) return false;
|
---|
636 | const nodeType = node.type;
|
---|
637 |
|
---|
638 | if (nodeType === "IfStatement") {
|
---|
639 | if (typeof opts === "undefined") {
|
---|
640 | return true;
|
---|
641 | } else {
|
---|
642 | return (0, _shallowEqual.default)(node, opts);
|
---|
643 | }
|
---|
644 | }
|
---|
645 |
|
---|
646 | return false;
|
---|
647 | }
|
---|
648 |
|
---|
649 | function isLabeledStatement(node, opts) {
|
---|
650 | if (!node) return false;
|
---|
651 | const nodeType = node.type;
|
---|
652 |
|
---|
653 | if (nodeType === "LabeledStatement") {
|
---|
654 | if (typeof opts === "undefined") {
|
---|
655 | return true;
|
---|
656 | } else {
|
---|
657 | return (0, _shallowEqual.default)(node, opts);
|
---|
658 | }
|
---|
659 | }
|
---|
660 |
|
---|
661 | return false;
|
---|
662 | }
|
---|
663 |
|
---|
664 | function isStringLiteral(node, opts) {
|
---|
665 | if (!node) return false;
|
---|
666 | const nodeType = node.type;
|
---|
667 |
|
---|
668 | if (nodeType === "StringLiteral") {
|
---|
669 | if (typeof opts === "undefined") {
|
---|
670 | return true;
|
---|
671 | } else {
|
---|
672 | return (0, _shallowEqual.default)(node, opts);
|
---|
673 | }
|
---|
674 | }
|
---|
675 |
|
---|
676 | return false;
|
---|
677 | }
|
---|
678 |
|
---|
679 | function isNumericLiteral(node, opts) {
|
---|
680 | if (!node) return false;
|
---|
681 | const nodeType = node.type;
|
---|
682 |
|
---|
683 | if (nodeType === "NumericLiteral") {
|
---|
684 | if (typeof opts === "undefined") {
|
---|
685 | return true;
|
---|
686 | } else {
|
---|
687 | return (0, _shallowEqual.default)(node, opts);
|
---|
688 | }
|
---|
689 | }
|
---|
690 |
|
---|
691 | return false;
|
---|
692 | }
|
---|
693 |
|
---|
694 | function isNullLiteral(node, opts) {
|
---|
695 | if (!node) return false;
|
---|
696 | const nodeType = node.type;
|
---|
697 |
|
---|
698 | if (nodeType === "NullLiteral") {
|
---|
699 | if (typeof opts === "undefined") {
|
---|
700 | return true;
|
---|
701 | } else {
|
---|
702 | return (0, _shallowEqual.default)(node, opts);
|
---|
703 | }
|
---|
704 | }
|
---|
705 |
|
---|
706 | return false;
|
---|
707 | }
|
---|
708 |
|
---|
709 | function isBooleanLiteral(node, opts) {
|
---|
710 | if (!node) return false;
|
---|
711 | const nodeType = node.type;
|
---|
712 |
|
---|
713 | if (nodeType === "BooleanLiteral") {
|
---|
714 | if (typeof opts === "undefined") {
|
---|
715 | return true;
|
---|
716 | } else {
|
---|
717 | return (0, _shallowEqual.default)(node, opts);
|
---|
718 | }
|
---|
719 | }
|
---|
720 |
|
---|
721 | return false;
|
---|
722 | }
|
---|
723 |
|
---|
724 | function isRegExpLiteral(node, opts) {
|
---|
725 | if (!node) return false;
|
---|
726 | const nodeType = node.type;
|
---|
727 |
|
---|
728 | if (nodeType === "RegExpLiteral") {
|
---|
729 | if (typeof opts === "undefined") {
|
---|
730 | return true;
|
---|
731 | } else {
|
---|
732 | return (0, _shallowEqual.default)(node, opts);
|
---|
733 | }
|
---|
734 | }
|
---|
735 |
|
---|
736 | return false;
|
---|
737 | }
|
---|
738 |
|
---|
739 | function isLogicalExpression(node, opts) {
|
---|
740 | if (!node) return false;
|
---|
741 | const nodeType = node.type;
|
---|
742 |
|
---|
743 | if (nodeType === "LogicalExpression") {
|
---|
744 | if (typeof opts === "undefined") {
|
---|
745 | return true;
|
---|
746 | } else {
|
---|
747 | return (0, _shallowEqual.default)(node, opts);
|
---|
748 | }
|
---|
749 | }
|
---|
750 |
|
---|
751 | return false;
|
---|
752 | }
|
---|
753 |
|
---|
754 | function isMemberExpression(node, opts) {
|
---|
755 | if (!node) return false;
|
---|
756 | const nodeType = node.type;
|
---|
757 |
|
---|
758 | if (nodeType === "MemberExpression") {
|
---|
759 | if (typeof opts === "undefined") {
|
---|
760 | return true;
|
---|
761 | } else {
|
---|
762 | return (0, _shallowEqual.default)(node, opts);
|
---|
763 | }
|
---|
764 | }
|
---|
765 |
|
---|
766 | return false;
|
---|
767 | }
|
---|
768 |
|
---|
769 | function isNewExpression(node, opts) {
|
---|
770 | if (!node) return false;
|
---|
771 | const nodeType = node.type;
|
---|
772 |
|
---|
773 | if (nodeType === "NewExpression") {
|
---|
774 | if (typeof opts === "undefined") {
|
---|
775 | return true;
|
---|
776 | } else {
|
---|
777 | return (0, _shallowEqual.default)(node, opts);
|
---|
778 | }
|
---|
779 | }
|
---|
780 |
|
---|
781 | return false;
|
---|
782 | }
|
---|
783 |
|
---|
784 | function isProgram(node, opts) {
|
---|
785 | if (!node) return false;
|
---|
786 | const nodeType = node.type;
|
---|
787 |
|
---|
788 | if (nodeType === "Program") {
|
---|
789 | if (typeof opts === "undefined") {
|
---|
790 | return true;
|
---|
791 | } else {
|
---|
792 | return (0, _shallowEqual.default)(node, opts);
|
---|
793 | }
|
---|
794 | }
|
---|
795 |
|
---|
796 | return false;
|
---|
797 | }
|
---|
798 |
|
---|
799 | function isObjectExpression(node, opts) {
|
---|
800 | if (!node) return false;
|
---|
801 | const nodeType = node.type;
|
---|
802 |
|
---|
803 | if (nodeType === "ObjectExpression") {
|
---|
804 | if (typeof opts === "undefined") {
|
---|
805 | return true;
|
---|
806 | } else {
|
---|
807 | return (0, _shallowEqual.default)(node, opts);
|
---|
808 | }
|
---|
809 | }
|
---|
810 |
|
---|
811 | return false;
|
---|
812 | }
|
---|
813 |
|
---|
814 | function isObjectMethod(node, opts) {
|
---|
815 | if (!node) return false;
|
---|
816 | const nodeType = node.type;
|
---|
817 |
|
---|
818 | if (nodeType === "ObjectMethod") {
|
---|
819 | if (typeof opts === "undefined") {
|
---|
820 | return true;
|
---|
821 | } else {
|
---|
822 | return (0, _shallowEqual.default)(node, opts);
|
---|
823 | }
|
---|
824 | }
|
---|
825 |
|
---|
826 | return false;
|
---|
827 | }
|
---|
828 |
|
---|
829 | function isObjectProperty(node, opts) {
|
---|
830 | if (!node) return false;
|
---|
831 | const nodeType = node.type;
|
---|
832 |
|
---|
833 | if (nodeType === "ObjectProperty") {
|
---|
834 | if (typeof opts === "undefined") {
|
---|
835 | return true;
|
---|
836 | } else {
|
---|
837 | return (0, _shallowEqual.default)(node, opts);
|
---|
838 | }
|
---|
839 | }
|
---|
840 |
|
---|
841 | return false;
|
---|
842 | }
|
---|
843 |
|
---|
844 | function isRestElement(node, opts) {
|
---|
845 | if (!node) return false;
|
---|
846 | const nodeType = node.type;
|
---|
847 |
|
---|
848 | if (nodeType === "RestElement") {
|
---|
849 | if (typeof opts === "undefined") {
|
---|
850 | return true;
|
---|
851 | } else {
|
---|
852 | return (0, _shallowEqual.default)(node, opts);
|
---|
853 | }
|
---|
854 | }
|
---|
855 |
|
---|
856 | return false;
|
---|
857 | }
|
---|
858 |
|
---|
859 | function isReturnStatement(node, opts) {
|
---|
860 | if (!node) return false;
|
---|
861 | const nodeType = node.type;
|
---|
862 |
|
---|
863 | if (nodeType === "ReturnStatement") {
|
---|
864 | if (typeof opts === "undefined") {
|
---|
865 | return true;
|
---|
866 | } else {
|
---|
867 | return (0, _shallowEqual.default)(node, opts);
|
---|
868 | }
|
---|
869 | }
|
---|
870 |
|
---|
871 | return false;
|
---|
872 | }
|
---|
873 |
|
---|
874 | function isSequenceExpression(node, opts) {
|
---|
875 | if (!node) return false;
|
---|
876 | const nodeType = node.type;
|
---|
877 |
|
---|
878 | if (nodeType === "SequenceExpression") {
|
---|
879 | if (typeof opts === "undefined") {
|
---|
880 | return true;
|
---|
881 | } else {
|
---|
882 | return (0, _shallowEqual.default)(node, opts);
|
---|
883 | }
|
---|
884 | }
|
---|
885 |
|
---|
886 | return false;
|
---|
887 | }
|
---|
888 |
|
---|
889 | function isParenthesizedExpression(node, opts) {
|
---|
890 | if (!node) return false;
|
---|
891 | const nodeType = node.type;
|
---|
892 |
|
---|
893 | if (nodeType === "ParenthesizedExpression") {
|
---|
894 | if (typeof opts === "undefined") {
|
---|
895 | return true;
|
---|
896 | } else {
|
---|
897 | return (0, _shallowEqual.default)(node, opts);
|
---|
898 | }
|
---|
899 | }
|
---|
900 |
|
---|
901 | return false;
|
---|
902 | }
|
---|
903 |
|
---|
904 | function isSwitchCase(node, opts) {
|
---|
905 | if (!node) return false;
|
---|
906 | const nodeType = node.type;
|
---|
907 |
|
---|
908 | if (nodeType === "SwitchCase") {
|
---|
909 | if (typeof opts === "undefined") {
|
---|
910 | return true;
|
---|
911 | } else {
|
---|
912 | return (0, _shallowEqual.default)(node, opts);
|
---|
913 | }
|
---|
914 | }
|
---|
915 |
|
---|
916 | return false;
|
---|
917 | }
|
---|
918 |
|
---|
919 | function isSwitchStatement(node, opts) {
|
---|
920 | if (!node) return false;
|
---|
921 | const nodeType = node.type;
|
---|
922 |
|
---|
923 | if (nodeType === "SwitchStatement") {
|
---|
924 | if (typeof opts === "undefined") {
|
---|
925 | return true;
|
---|
926 | } else {
|
---|
927 | return (0, _shallowEqual.default)(node, opts);
|
---|
928 | }
|
---|
929 | }
|
---|
930 |
|
---|
931 | return false;
|
---|
932 | }
|
---|
933 |
|
---|
934 | function isThisExpression(node, opts) {
|
---|
935 | if (!node) return false;
|
---|
936 | const nodeType = node.type;
|
---|
937 |
|
---|
938 | if (nodeType === "ThisExpression") {
|
---|
939 | if (typeof opts === "undefined") {
|
---|
940 | return true;
|
---|
941 | } else {
|
---|
942 | return (0, _shallowEqual.default)(node, opts);
|
---|
943 | }
|
---|
944 | }
|
---|
945 |
|
---|
946 | return false;
|
---|
947 | }
|
---|
948 |
|
---|
949 | function isThrowStatement(node, opts) {
|
---|
950 | if (!node) return false;
|
---|
951 | const nodeType = node.type;
|
---|
952 |
|
---|
953 | if (nodeType === "ThrowStatement") {
|
---|
954 | if (typeof opts === "undefined") {
|
---|
955 | return true;
|
---|
956 | } else {
|
---|
957 | return (0, _shallowEqual.default)(node, opts);
|
---|
958 | }
|
---|
959 | }
|
---|
960 |
|
---|
961 | return false;
|
---|
962 | }
|
---|
963 |
|
---|
964 | function isTryStatement(node, opts) {
|
---|
965 | if (!node) return false;
|
---|
966 | const nodeType = node.type;
|
---|
967 |
|
---|
968 | if (nodeType === "TryStatement") {
|
---|
969 | if (typeof opts === "undefined") {
|
---|
970 | return true;
|
---|
971 | } else {
|
---|
972 | return (0, _shallowEqual.default)(node, opts);
|
---|
973 | }
|
---|
974 | }
|
---|
975 |
|
---|
976 | return false;
|
---|
977 | }
|
---|
978 |
|
---|
979 | function isUnaryExpression(node, opts) {
|
---|
980 | if (!node) return false;
|
---|
981 | const nodeType = node.type;
|
---|
982 |
|
---|
983 | if (nodeType === "UnaryExpression") {
|
---|
984 | if (typeof opts === "undefined") {
|
---|
985 | return true;
|
---|
986 | } else {
|
---|
987 | return (0, _shallowEqual.default)(node, opts);
|
---|
988 | }
|
---|
989 | }
|
---|
990 |
|
---|
991 | return false;
|
---|
992 | }
|
---|
993 |
|
---|
994 | function isUpdateExpression(node, opts) {
|
---|
995 | if (!node) return false;
|
---|
996 | const nodeType = node.type;
|
---|
997 |
|
---|
998 | if (nodeType === "UpdateExpression") {
|
---|
999 | if (typeof opts === "undefined") {
|
---|
1000 | return true;
|
---|
1001 | } else {
|
---|
1002 | return (0, _shallowEqual.default)(node, opts);
|
---|
1003 | }
|
---|
1004 | }
|
---|
1005 |
|
---|
1006 | return false;
|
---|
1007 | }
|
---|
1008 |
|
---|
1009 | function isVariableDeclaration(node, opts) {
|
---|
1010 | if (!node) return false;
|
---|
1011 | const nodeType = node.type;
|
---|
1012 |
|
---|
1013 | if (nodeType === "VariableDeclaration") {
|
---|
1014 | if (typeof opts === "undefined") {
|
---|
1015 | return true;
|
---|
1016 | } else {
|
---|
1017 | return (0, _shallowEqual.default)(node, opts);
|
---|
1018 | }
|
---|
1019 | }
|
---|
1020 |
|
---|
1021 | return false;
|
---|
1022 | }
|
---|
1023 |
|
---|
1024 | function isVariableDeclarator(node, opts) {
|
---|
1025 | if (!node) return false;
|
---|
1026 | const nodeType = node.type;
|
---|
1027 |
|
---|
1028 | if (nodeType === "VariableDeclarator") {
|
---|
1029 | if (typeof opts === "undefined") {
|
---|
1030 | return true;
|
---|
1031 | } else {
|
---|
1032 | return (0, _shallowEqual.default)(node, opts);
|
---|
1033 | }
|
---|
1034 | }
|
---|
1035 |
|
---|
1036 | return false;
|
---|
1037 | }
|
---|
1038 |
|
---|
1039 | function isWhileStatement(node, opts) {
|
---|
1040 | if (!node) return false;
|
---|
1041 | const nodeType = node.type;
|
---|
1042 |
|
---|
1043 | if (nodeType === "WhileStatement") {
|
---|
1044 | if (typeof opts === "undefined") {
|
---|
1045 | return true;
|
---|
1046 | } else {
|
---|
1047 | return (0, _shallowEqual.default)(node, opts);
|
---|
1048 | }
|
---|
1049 | }
|
---|
1050 |
|
---|
1051 | return false;
|
---|
1052 | }
|
---|
1053 |
|
---|
1054 | function isWithStatement(node, opts) {
|
---|
1055 | if (!node) return false;
|
---|
1056 | const nodeType = node.type;
|
---|
1057 |
|
---|
1058 | if (nodeType === "WithStatement") {
|
---|
1059 | if (typeof opts === "undefined") {
|
---|
1060 | return true;
|
---|
1061 | } else {
|
---|
1062 | return (0, _shallowEqual.default)(node, opts);
|
---|
1063 | }
|
---|
1064 | }
|
---|
1065 |
|
---|
1066 | return false;
|
---|
1067 | }
|
---|
1068 |
|
---|
1069 | function isAssignmentPattern(node, opts) {
|
---|
1070 | if (!node) return false;
|
---|
1071 | const nodeType = node.type;
|
---|
1072 |
|
---|
1073 | if (nodeType === "AssignmentPattern") {
|
---|
1074 | if (typeof opts === "undefined") {
|
---|
1075 | return true;
|
---|
1076 | } else {
|
---|
1077 | return (0, _shallowEqual.default)(node, opts);
|
---|
1078 | }
|
---|
1079 | }
|
---|
1080 |
|
---|
1081 | return false;
|
---|
1082 | }
|
---|
1083 |
|
---|
1084 | function isArrayPattern(node, opts) {
|
---|
1085 | if (!node) return false;
|
---|
1086 | const nodeType = node.type;
|
---|
1087 |
|
---|
1088 | if (nodeType === "ArrayPattern") {
|
---|
1089 | if (typeof opts === "undefined") {
|
---|
1090 | return true;
|
---|
1091 | } else {
|
---|
1092 | return (0, _shallowEqual.default)(node, opts);
|
---|
1093 | }
|
---|
1094 | }
|
---|
1095 |
|
---|
1096 | return false;
|
---|
1097 | }
|
---|
1098 |
|
---|
1099 | function isArrowFunctionExpression(node, opts) {
|
---|
1100 | if (!node) return false;
|
---|
1101 | const nodeType = node.type;
|
---|
1102 |
|
---|
1103 | if (nodeType === "ArrowFunctionExpression") {
|
---|
1104 | if (typeof opts === "undefined") {
|
---|
1105 | return true;
|
---|
1106 | } else {
|
---|
1107 | return (0, _shallowEqual.default)(node, opts);
|
---|
1108 | }
|
---|
1109 | }
|
---|
1110 |
|
---|
1111 | return false;
|
---|
1112 | }
|
---|
1113 |
|
---|
1114 | function isClassBody(node, opts) {
|
---|
1115 | if (!node) return false;
|
---|
1116 | const nodeType = node.type;
|
---|
1117 |
|
---|
1118 | if (nodeType === "ClassBody") {
|
---|
1119 | if (typeof opts === "undefined") {
|
---|
1120 | return true;
|
---|
1121 | } else {
|
---|
1122 | return (0, _shallowEqual.default)(node, opts);
|
---|
1123 | }
|
---|
1124 | }
|
---|
1125 |
|
---|
1126 | return false;
|
---|
1127 | }
|
---|
1128 |
|
---|
1129 | function isClassExpression(node, opts) {
|
---|
1130 | if (!node) return false;
|
---|
1131 | const nodeType = node.type;
|
---|
1132 |
|
---|
1133 | if (nodeType === "ClassExpression") {
|
---|
1134 | if (typeof opts === "undefined") {
|
---|
1135 | return true;
|
---|
1136 | } else {
|
---|
1137 | return (0, _shallowEqual.default)(node, opts);
|
---|
1138 | }
|
---|
1139 | }
|
---|
1140 |
|
---|
1141 | return false;
|
---|
1142 | }
|
---|
1143 |
|
---|
1144 | function isClassDeclaration(node, opts) {
|
---|
1145 | if (!node) return false;
|
---|
1146 | const nodeType = node.type;
|
---|
1147 |
|
---|
1148 | if (nodeType === "ClassDeclaration") {
|
---|
1149 | if (typeof opts === "undefined") {
|
---|
1150 | return true;
|
---|
1151 | } else {
|
---|
1152 | return (0, _shallowEqual.default)(node, opts);
|
---|
1153 | }
|
---|
1154 | }
|
---|
1155 |
|
---|
1156 | return false;
|
---|
1157 | }
|
---|
1158 |
|
---|
1159 | function isExportAllDeclaration(node, opts) {
|
---|
1160 | if (!node) return false;
|
---|
1161 | const nodeType = node.type;
|
---|
1162 |
|
---|
1163 | if (nodeType === "ExportAllDeclaration") {
|
---|
1164 | if (typeof opts === "undefined") {
|
---|
1165 | return true;
|
---|
1166 | } else {
|
---|
1167 | return (0, _shallowEqual.default)(node, opts);
|
---|
1168 | }
|
---|
1169 | }
|
---|
1170 |
|
---|
1171 | return false;
|
---|
1172 | }
|
---|
1173 |
|
---|
1174 | function isExportDefaultDeclaration(node, opts) {
|
---|
1175 | if (!node) return false;
|
---|
1176 | const nodeType = node.type;
|
---|
1177 |
|
---|
1178 | if (nodeType === "ExportDefaultDeclaration") {
|
---|
1179 | if (typeof opts === "undefined") {
|
---|
1180 | return true;
|
---|
1181 | } else {
|
---|
1182 | return (0, _shallowEqual.default)(node, opts);
|
---|
1183 | }
|
---|
1184 | }
|
---|
1185 |
|
---|
1186 | return false;
|
---|
1187 | }
|
---|
1188 |
|
---|
1189 | function isExportNamedDeclaration(node, opts) {
|
---|
1190 | if (!node) return false;
|
---|
1191 | const nodeType = node.type;
|
---|
1192 |
|
---|
1193 | if (nodeType === "ExportNamedDeclaration") {
|
---|
1194 | if (typeof opts === "undefined") {
|
---|
1195 | return true;
|
---|
1196 | } else {
|
---|
1197 | return (0, _shallowEqual.default)(node, opts);
|
---|
1198 | }
|
---|
1199 | }
|
---|
1200 |
|
---|
1201 | return false;
|
---|
1202 | }
|
---|
1203 |
|
---|
1204 | function isExportSpecifier(node, opts) {
|
---|
1205 | if (!node) return false;
|
---|
1206 | const nodeType = node.type;
|
---|
1207 |
|
---|
1208 | if (nodeType === "ExportSpecifier") {
|
---|
1209 | if (typeof opts === "undefined") {
|
---|
1210 | return true;
|
---|
1211 | } else {
|
---|
1212 | return (0, _shallowEqual.default)(node, opts);
|
---|
1213 | }
|
---|
1214 | }
|
---|
1215 |
|
---|
1216 | return false;
|
---|
1217 | }
|
---|
1218 |
|
---|
1219 | function isForOfStatement(node, opts) {
|
---|
1220 | if (!node) return false;
|
---|
1221 | const nodeType = node.type;
|
---|
1222 |
|
---|
1223 | if (nodeType === "ForOfStatement") {
|
---|
1224 | if (typeof opts === "undefined") {
|
---|
1225 | return true;
|
---|
1226 | } else {
|
---|
1227 | return (0, _shallowEqual.default)(node, opts);
|
---|
1228 | }
|
---|
1229 | }
|
---|
1230 |
|
---|
1231 | return false;
|
---|
1232 | }
|
---|
1233 |
|
---|
1234 | function isImportDeclaration(node, opts) {
|
---|
1235 | if (!node) return false;
|
---|
1236 | const nodeType = node.type;
|
---|
1237 |
|
---|
1238 | if (nodeType === "ImportDeclaration") {
|
---|
1239 | if (typeof opts === "undefined") {
|
---|
1240 | return true;
|
---|
1241 | } else {
|
---|
1242 | return (0, _shallowEqual.default)(node, opts);
|
---|
1243 | }
|
---|
1244 | }
|
---|
1245 |
|
---|
1246 | return false;
|
---|
1247 | }
|
---|
1248 |
|
---|
1249 | function isImportDefaultSpecifier(node, opts) {
|
---|
1250 | if (!node) return false;
|
---|
1251 | const nodeType = node.type;
|
---|
1252 |
|
---|
1253 | if (nodeType === "ImportDefaultSpecifier") {
|
---|
1254 | if (typeof opts === "undefined") {
|
---|
1255 | return true;
|
---|
1256 | } else {
|
---|
1257 | return (0, _shallowEqual.default)(node, opts);
|
---|
1258 | }
|
---|
1259 | }
|
---|
1260 |
|
---|
1261 | return false;
|
---|
1262 | }
|
---|
1263 |
|
---|
1264 | function isImportNamespaceSpecifier(node, opts) {
|
---|
1265 | if (!node) return false;
|
---|
1266 | const nodeType = node.type;
|
---|
1267 |
|
---|
1268 | if (nodeType === "ImportNamespaceSpecifier") {
|
---|
1269 | if (typeof opts === "undefined") {
|
---|
1270 | return true;
|
---|
1271 | } else {
|
---|
1272 | return (0, _shallowEqual.default)(node, opts);
|
---|
1273 | }
|
---|
1274 | }
|
---|
1275 |
|
---|
1276 | return false;
|
---|
1277 | }
|
---|
1278 |
|
---|
1279 | function isImportSpecifier(node, opts) {
|
---|
1280 | if (!node) return false;
|
---|
1281 | const nodeType = node.type;
|
---|
1282 |
|
---|
1283 | if (nodeType === "ImportSpecifier") {
|
---|
1284 | if (typeof opts === "undefined") {
|
---|
1285 | return true;
|
---|
1286 | } else {
|
---|
1287 | return (0, _shallowEqual.default)(node, opts);
|
---|
1288 | }
|
---|
1289 | }
|
---|
1290 |
|
---|
1291 | return false;
|
---|
1292 | }
|
---|
1293 |
|
---|
1294 | function isMetaProperty(node, opts) {
|
---|
1295 | if (!node) return false;
|
---|
1296 | const nodeType = node.type;
|
---|
1297 |
|
---|
1298 | if (nodeType === "MetaProperty") {
|
---|
1299 | if (typeof opts === "undefined") {
|
---|
1300 | return true;
|
---|
1301 | } else {
|
---|
1302 | return (0, _shallowEqual.default)(node, opts);
|
---|
1303 | }
|
---|
1304 | }
|
---|
1305 |
|
---|
1306 | return false;
|
---|
1307 | }
|
---|
1308 |
|
---|
1309 | function isClassMethod(node, opts) {
|
---|
1310 | if (!node) return false;
|
---|
1311 | const nodeType = node.type;
|
---|
1312 |
|
---|
1313 | if (nodeType === "ClassMethod") {
|
---|
1314 | if (typeof opts === "undefined") {
|
---|
1315 | return true;
|
---|
1316 | } else {
|
---|
1317 | return (0, _shallowEqual.default)(node, opts);
|
---|
1318 | }
|
---|
1319 | }
|
---|
1320 |
|
---|
1321 | return false;
|
---|
1322 | }
|
---|
1323 |
|
---|
1324 | function isObjectPattern(node, opts) {
|
---|
1325 | if (!node) return false;
|
---|
1326 | const nodeType = node.type;
|
---|
1327 |
|
---|
1328 | if (nodeType === "ObjectPattern") {
|
---|
1329 | if (typeof opts === "undefined") {
|
---|
1330 | return true;
|
---|
1331 | } else {
|
---|
1332 | return (0, _shallowEqual.default)(node, opts);
|
---|
1333 | }
|
---|
1334 | }
|
---|
1335 |
|
---|
1336 | return false;
|
---|
1337 | }
|
---|
1338 |
|
---|
1339 | function isSpreadElement(node, opts) {
|
---|
1340 | if (!node) return false;
|
---|
1341 | const nodeType = node.type;
|
---|
1342 |
|
---|
1343 | if (nodeType === "SpreadElement") {
|
---|
1344 | if (typeof opts === "undefined") {
|
---|
1345 | return true;
|
---|
1346 | } else {
|
---|
1347 | return (0, _shallowEqual.default)(node, opts);
|
---|
1348 | }
|
---|
1349 | }
|
---|
1350 |
|
---|
1351 | return false;
|
---|
1352 | }
|
---|
1353 |
|
---|
1354 | function isSuper(node, opts) {
|
---|
1355 | if (!node) return false;
|
---|
1356 | const nodeType = node.type;
|
---|
1357 |
|
---|
1358 | if (nodeType === "Super") {
|
---|
1359 | if (typeof opts === "undefined") {
|
---|
1360 | return true;
|
---|
1361 | } else {
|
---|
1362 | return (0, _shallowEqual.default)(node, opts);
|
---|
1363 | }
|
---|
1364 | }
|
---|
1365 |
|
---|
1366 | return false;
|
---|
1367 | }
|
---|
1368 |
|
---|
1369 | function isTaggedTemplateExpression(node, opts) {
|
---|
1370 | if (!node) return false;
|
---|
1371 | const nodeType = node.type;
|
---|
1372 |
|
---|
1373 | if (nodeType === "TaggedTemplateExpression") {
|
---|
1374 | if (typeof opts === "undefined") {
|
---|
1375 | return true;
|
---|
1376 | } else {
|
---|
1377 | return (0, _shallowEqual.default)(node, opts);
|
---|
1378 | }
|
---|
1379 | }
|
---|
1380 |
|
---|
1381 | return false;
|
---|
1382 | }
|
---|
1383 |
|
---|
1384 | function isTemplateElement(node, opts) {
|
---|
1385 | if (!node) return false;
|
---|
1386 | const nodeType = node.type;
|
---|
1387 |
|
---|
1388 | if (nodeType === "TemplateElement") {
|
---|
1389 | if (typeof opts === "undefined") {
|
---|
1390 | return true;
|
---|
1391 | } else {
|
---|
1392 | return (0, _shallowEqual.default)(node, opts);
|
---|
1393 | }
|
---|
1394 | }
|
---|
1395 |
|
---|
1396 | return false;
|
---|
1397 | }
|
---|
1398 |
|
---|
1399 | function isTemplateLiteral(node, opts) {
|
---|
1400 | if (!node) return false;
|
---|
1401 | const nodeType = node.type;
|
---|
1402 |
|
---|
1403 | if (nodeType === "TemplateLiteral") {
|
---|
1404 | if (typeof opts === "undefined") {
|
---|
1405 | return true;
|
---|
1406 | } else {
|
---|
1407 | return (0, _shallowEqual.default)(node, opts);
|
---|
1408 | }
|
---|
1409 | }
|
---|
1410 |
|
---|
1411 | return false;
|
---|
1412 | }
|
---|
1413 |
|
---|
1414 | function isYieldExpression(node, opts) {
|
---|
1415 | if (!node) return false;
|
---|
1416 | const nodeType = node.type;
|
---|
1417 |
|
---|
1418 | if (nodeType === "YieldExpression") {
|
---|
1419 | if (typeof opts === "undefined") {
|
---|
1420 | return true;
|
---|
1421 | } else {
|
---|
1422 | return (0, _shallowEqual.default)(node, opts);
|
---|
1423 | }
|
---|
1424 | }
|
---|
1425 |
|
---|
1426 | return false;
|
---|
1427 | }
|
---|
1428 |
|
---|
1429 | function isAwaitExpression(node, opts) {
|
---|
1430 | if (!node) return false;
|
---|
1431 | const nodeType = node.type;
|
---|
1432 |
|
---|
1433 | if (nodeType === "AwaitExpression") {
|
---|
1434 | if (typeof opts === "undefined") {
|
---|
1435 | return true;
|
---|
1436 | } else {
|
---|
1437 | return (0, _shallowEqual.default)(node, opts);
|
---|
1438 | }
|
---|
1439 | }
|
---|
1440 |
|
---|
1441 | return false;
|
---|
1442 | }
|
---|
1443 |
|
---|
1444 | function isImport(node, opts) {
|
---|
1445 | if (!node) return false;
|
---|
1446 | const nodeType = node.type;
|
---|
1447 |
|
---|
1448 | if (nodeType === "Import") {
|
---|
1449 | if (typeof opts === "undefined") {
|
---|
1450 | return true;
|
---|
1451 | } else {
|
---|
1452 | return (0, _shallowEqual.default)(node, opts);
|
---|
1453 | }
|
---|
1454 | }
|
---|
1455 |
|
---|
1456 | return false;
|
---|
1457 | }
|
---|
1458 |
|
---|
1459 | function isBigIntLiteral(node, opts) {
|
---|
1460 | if (!node) return false;
|
---|
1461 | const nodeType = node.type;
|
---|
1462 |
|
---|
1463 | if (nodeType === "BigIntLiteral") {
|
---|
1464 | if (typeof opts === "undefined") {
|
---|
1465 | return true;
|
---|
1466 | } else {
|
---|
1467 | return (0, _shallowEqual.default)(node, opts);
|
---|
1468 | }
|
---|
1469 | }
|
---|
1470 |
|
---|
1471 | return false;
|
---|
1472 | }
|
---|
1473 |
|
---|
1474 | function isExportNamespaceSpecifier(node, opts) {
|
---|
1475 | if (!node) return false;
|
---|
1476 | const nodeType = node.type;
|
---|
1477 |
|
---|
1478 | if (nodeType === "ExportNamespaceSpecifier") {
|
---|
1479 | if (typeof opts === "undefined") {
|
---|
1480 | return true;
|
---|
1481 | } else {
|
---|
1482 | return (0, _shallowEqual.default)(node, opts);
|
---|
1483 | }
|
---|
1484 | }
|
---|
1485 |
|
---|
1486 | return false;
|
---|
1487 | }
|
---|
1488 |
|
---|
1489 | function isOptionalMemberExpression(node, opts) {
|
---|
1490 | if (!node) return false;
|
---|
1491 | const nodeType = node.type;
|
---|
1492 |
|
---|
1493 | if (nodeType === "OptionalMemberExpression") {
|
---|
1494 | if (typeof opts === "undefined") {
|
---|
1495 | return true;
|
---|
1496 | } else {
|
---|
1497 | return (0, _shallowEqual.default)(node, opts);
|
---|
1498 | }
|
---|
1499 | }
|
---|
1500 |
|
---|
1501 | return false;
|
---|
1502 | }
|
---|
1503 |
|
---|
1504 | function isOptionalCallExpression(node, opts) {
|
---|
1505 | if (!node) return false;
|
---|
1506 | const nodeType = node.type;
|
---|
1507 |
|
---|
1508 | if (nodeType === "OptionalCallExpression") {
|
---|
1509 | if (typeof opts === "undefined") {
|
---|
1510 | return true;
|
---|
1511 | } else {
|
---|
1512 | return (0, _shallowEqual.default)(node, opts);
|
---|
1513 | }
|
---|
1514 | }
|
---|
1515 |
|
---|
1516 | return false;
|
---|
1517 | }
|
---|
1518 |
|
---|
1519 | function isClassProperty(node, opts) {
|
---|
1520 | if (!node) return false;
|
---|
1521 | const nodeType = node.type;
|
---|
1522 |
|
---|
1523 | if (nodeType === "ClassProperty") {
|
---|
1524 | if (typeof opts === "undefined") {
|
---|
1525 | return true;
|
---|
1526 | } else {
|
---|
1527 | return (0, _shallowEqual.default)(node, opts);
|
---|
1528 | }
|
---|
1529 | }
|
---|
1530 |
|
---|
1531 | return false;
|
---|
1532 | }
|
---|
1533 |
|
---|
1534 | function isClassPrivateProperty(node, opts) {
|
---|
1535 | if (!node) return false;
|
---|
1536 | const nodeType = node.type;
|
---|
1537 |
|
---|
1538 | if (nodeType === "ClassPrivateProperty") {
|
---|
1539 | if (typeof opts === "undefined") {
|
---|
1540 | return true;
|
---|
1541 | } else {
|
---|
1542 | return (0, _shallowEqual.default)(node, opts);
|
---|
1543 | }
|
---|
1544 | }
|
---|
1545 |
|
---|
1546 | return false;
|
---|
1547 | }
|
---|
1548 |
|
---|
1549 | function isClassPrivateMethod(node, opts) {
|
---|
1550 | if (!node) return false;
|
---|
1551 | const nodeType = node.type;
|
---|
1552 |
|
---|
1553 | if (nodeType === "ClassPrivateMethod") {
|
---|
1554 | if (typeof opts === "undefined") {
|
---|
1555 | return true;
|
---|
1556 | } else {
|
---|
1557 | return (0, _shallowEqual.default)(node, opts);
|
---|
1558 | }
|
---|
1559 | }
|
---|
1560 |
|
---|
1561 | return false;
|
---|
1562 | }
|
---|
1563 |
|
---|
1564 | function isPrivateName(node, opts) {
|
---|
1565 | if (!node) return false;
|
---|
1566 | const nodeType = node.type;
|
---|
1567 |
|
---|
1568 | if (nodeType === "PrivateName") {
|
---|
1569 | if (typeof opts === "undefined") {
|
---|
1570 | return true;
|
---|
1571 | } else {
|
---|
1572 | return (0, _shallowEqual.default)(node, opts);
|
---|
1573 | }
|
---|
1574 | }
|
---|
1575 |
|
---|
1576 | return false;
|
---|
1577 | }
|
---|
1578 |
|
---|
1579 | function isAnyTypeAnnotation(node, opts) {
|
---|
1580 | if (!node) return false;
|
---|
1581 | const nodeType = node.type;
|
---|
1582 |
|
---|
1583 | if (nodeType === "AnyTypeAnnotation") {
|
---|
1584 | if (typeof opts === "undefined") {
|
---|
1585 | return true;
|
---|
1586 | } else {
|
---|
1587 | return (0, _shallowEqual.default)(node, opts);
|
---|
1588 | }
|
---|
1589 | }
|
---|
1590 |
|
---|
1591 | return false;
|
---|
1592 | }
|
---|
1593 |
|
---|
1594 | function isArrayTypeAnnotation(node, opts) {
|
---|
1595 | if (!node) return false;
|
---|
1596 | const nodeType = node.type;
|
---|
1597 |
|
---|
1598 | if (nodeType === "ArrayTypeAnnotation") {
|
---|
1599 | if (typeof opts === "undefined") {
|
---|
1600 | return true;
|
---|
1601 | } else {
|
---|
1602 | return (0, _shallowEqual.default)(node, opts);
|
---|
1603 | }
|
---|
1604 | }
|
---|
1605 |
|
---|
1606 | return false;
|
---|
1607 | }
|
---|
1608 |
|
---|
1609 | function isBooleanTypeAnnotation(node, opts) {
|
---|
1610 | if (!node) return false;
|
---|
1611 | const nodeType = node.type;
|
---|
1612 |
|
---|
1613 | if (nodeType === "BooleanTypeAnnotation") {
|
---|
1614 | if (typeof opts === "undefined") {
|
---|
1615 | return true;
|
---|
1616 | } else {
|
---|
1617 | return (0, _shallowEqual.default)(node, opts);
|
---|
1618 | }
|
---|
1619 | }
|
---|
1620 |
|
---|
1621 | return false;
|
---|
1622 | }
|
---|
1623 |
|
---|
1624 | function isBooleanLiteralTypeAnnotation(node, opts) {
|
---|
1625 | if (!node) return false;
|
---|
1626 | const nodeType = node.type;
|
---|
1627 |
|
---|
1628 | if (nodeType === "BooleanLiteralTypeAnnotation") {
|
---|
1629 | if (typeof opts === "undefined") {
|
---|
1630 | return true;
|
---|
1631 | } else {
|
---|
1632 | return (0, _shallowEqual.default)(node, opts);
|
---|
1633 | }
|
---|
1634 | }
|
---|
1635 |
|
---|
1636 | return false;
|
---|
1637 | }
|
---|
1638 |
|
---|
1639 | function isNullLiteralTypeAnnotation(node, opts) {
|
---|
1640 | if (!node) return false;
|
---|
1641 | const nodeType = node.type;
|
---|
1642 |
|
---|
1643 | if (nodeType === "NullLiteralTypeAnnotation") {
|
---|
1644 | if (typeof opts === "undefined") {
|
---|
1645 | return true;
|
---|
1646 | } else {
|
---|
1647 | return (0, _shallowEqual.default)(node, opts);
|
---|
1648 | }
|
---|
1649 | }
|
---|
1650 |
|
---|
1651 | return false;
|
---|
1652 | }
|
---|
1653 |
|
---|
1654 | function isClassImplements(node, opts) {
|
---|
1655 | if (!node) return false;
|
---|
1656 | const nodeType = node.type;
|
---|
1657 |
|
---|
1658 | if (nodeType === "ClassImplements") {
|
---|
1659 | if (typeof opts === "undefined") {
|
---|
1660 | return true;
|
---|
1661 | } else {
|
---|
1662 | return (0, _shallowEqual.default)(node, opts);
|
---|
1663 | }
|
---|
1664 | }
|
---|
1665 |
|
---|
1666 | return false;
|
---|
1667 | }
|
---|
1668 |
|
---|
1669 | function isDeclareClass(node, opts) {
|
---|
1670 | if (!node) return false;
|
---|
1671 | const nodeType = node.type;
|
---|
1672 |
|
---|
1673 | if (nodeType === "DeclareClass") {
|
---|
1674 | if (typeof opts === "undefined") {
|
---|
1675 | return true;
|
---|
1676 | } else {
|
---|
1677 | return (0, _shallowEqual.default)(node, opts);
|
---|
1678 | }
|
---|
1679 | }
|
---|
1680 |
|
---|
1681 | return false;
|
---|
1682 | }
|
---|
1683 |
|
---|
1684 | function isDeclareFunction(node, opts) {
|
---|
1685 | if (!node) return false;
|
---|
1686 | const nodeType = node.type;
|
---|
1687 |
|
---|
1688 | if (nodeType === "DeclareFunction") {
|
---|
1689 | if (typeof opts === "undefined") {
|
---|
1690 | return true;
|
---|
1691 | } else {
|
---|
1692 | return (0, _shallowEqual.default)(node, opts);
|
---|
1693 | }
|
---|
1694 | }
|
---|
1695 |
|
---|
1696 | return false;
|
---|
1697 | }
|
---|
1698 |
|
---|
1699 | function isDeclareInterface(node, opts) {
|
---|
1700 | if (!node) return false;
|
---|
1701 | const nodeType = node.type;
|
---|
1702 |
|
---|
1703 | if (nodeType === "DeclareInterface") {
|
---|
1704 | if (typeof opts === "undefined") {
|
---|
1705 | return true;
|
---|
1706 | } else {
|
---|
1707 | return (0, _shallowEqual.default)(node, opts);
|
---|
1708 | }
|
---|
1709 | }
|
---|
1710 |
|
---|
1711 | return false;
|
---|
1712 | }
|
---|
1713 |
|
---|
1714 | function isDeclareModule(node, opts) {
|
---|
1715 | if (!node) return false;
|
---|
1716 | const nodeType = node.type;
|
---|
1717 |
|
---|
1718 | if (nodeType === "DeclareModule") {
|
---|
1719 | if (typeof opts === "undefined") {
|
---|
1720 | return true;
|
---|
1721 | } else {
|
---|
1722 | return (0, _shallowEqual.default)(node, opts);
|
---|
1723 | }
|
---|
1724 | }
|
---|
1725 |
|
---|
1726 | return false;
|
---|
1727 | }
|
---|
1728 |
|
---|
1729 | function isDeclareModuleExports(node, opts) {
|
---|
1730 | if (!node) return false;
|
---|
1731 | const nodeType = node.type;
|
---|
1732 |
|
---|
1733 | if (nodeType === "DeclareModuleExports") {
|
---|
1734 | if (typeof opts === "undefined") {
|
---|
1735 | return true;
|
---|
1736 | } else {
|
---|
1737 | return (0, _shallowEqual.default)(node, opts);
|
---|
1738 | }
|
---|
1739 | }
|
---|
1740 |
|
---|
1741 | return false;
|
---|
1742 | }
|
---|
1743 |
|
---|
1744 | function isDeclareTypeAlias(node, opts) {
|
---|
1745 | if (!node) return false;
|
---|
1746 | const nodeType = node.type;
|
---|
1747 |
|
---|
1748 | if (nodeType === "DeclareTypeAlias") {
|
---|
1749 | if (typeof opts === "undefined") {
|
---|
1750 | return true;
|
---|
1751 | } else {
|
---|
1752 | return (0, _shallowEqual.default)(node, opts);
|
---|
1753 | }
|
---|
1754 | }
|
---|
1755 |
|
---|
1756 | return false;
|
---|
1757 | }
|
---|
1758 |
|
---|
1759 | function isDeclareOpaqueType(node, opts) {
|
---|
1760 | if (!node) return false;
|
---|
1761 | const nodeType = node.type;
|
---|
1762 |
|
---|
1763 | if (nodeType === "DeclareOpaqueType") {
|
---|
1764 | if (typeof opts === "undefined") {
|
---|
1765 | return true;
|
---|
1766 | } else {
|
---|
1767 | return (0, _shallowEqual.default)(node, opts);
|
---|
1768 | }
|
---|
1769 | }
|
---|
1770 |
|
---|
1771 | return false;
|
---|
1772 | }
|
---|
1773 |
|
---|
1774 | function isDeclareVariable(node, opts) {
|
---|
1775 | if (!node) return false;
|
---|
1776 | const nodeType = node.type;
|
---|
1777 |
|
---|
1778 | if (nodeType === "DeclareVariable") {
|
---|
1779 | if (typeof opts === "undefined") {
|
---|
1780 | return true;
|
---|
1781 | } else {
|
---|
1782 | return (0, _shallowEqual.default)(node, opts);
|
---|
1783 | }
|
---|
1784 | }
|
---|
1785 |
|
---|
1786 | return false;
|
---|
1787 | }
|
---|
1788 |
|
---|
1789 | function isDeclareExportDeclaration(node, opts) {
|
---|
1790 | if (!node) return false;
|
---|
1791 | const nodeType = node.type;
|
---|
1792 |
|
---|
1793 | if (nodeType === "DeclareExportDeclaration") {
|
---|
1794 | if (typeof opts === "undefined") {
|
---|
1795 | return true;
|
---|
1796 | } else {
|
---|
1797 | return (0, _shallowEqual.default)(node, opts);
|
---|
1798 | }
|
---|
1799 | }
|
---|
1800 |
|
---|
1801 | return false;
|
---|
1802 | }
|
---|
1803 |
|
---|
1804 | function isDeclareExportAllDeclaration(node, opts) {
|
---|
1805 | if (!node) return false;
|
---|
1806 | const nodeType = node.type;
|
---|
1807 |
|
---|
1808 | if (nodeType === "DeclareExportAllDeclaration") {
|
---|
1809 | if (typeof opts === "undefined") {
|
---|
1810 | return true;
|
---|
1811 | } else {
|
---|
1812 | return (0, _shallowEqual.default)(node, opts);
|
---|
1813 | }
|
---|
1814 | }
|
---|
1815 |
|
---|
1816 | return false;
|
---|
1817 | }
|
---|
1818 |
|
---|
1819 | function isDeclaredPredicate(node, opts) {
|
---|
1820 | if (!node) return false;
|
---|
1821 | const nodeType = node.type;
|
---|
1822 |
|
---|
1823 | if (nodeType === "DeclaredPredicate") {
|
---|
1824 | if (typeof opts === "undefined") {
|
---|
1825 | return true;
|
---|
1826 | } else {
|
---|
1827 | return (0, _shallowEqual.default)(node, opts);
|
---|
1828 | }
|
---|
1829 | }
|
---|
1830 |
|
---|
1831 | return false;
|
---|
1832 | }
|
---|
1833 |
|
---|
1834 | function isExistsTypeAnnotation(node, opts) {
|
---|
1835 | if (!node) return false;
|
---|
1836 | const nodeType = node.type;
|
---|
1837 |
|
---|
1838 | if (nodeType === "ExistsTypeAnnotation") {
|
---|
1839 | if (typeof opts === "undefined") {
|
---|
1840 | return true;
|
---|
1841 | } else {
|
---|
1842 | return (0, _shallowEqual.default)(node, opts);
|
---|
1843 | }
|
---|
1844 | }
|
---|
1845 |
|
---|
1846 | return false;
|
---|
1847 | }
|
---|
1848 |
|
---|
1849 | function isFunctionTypeAnnotation(node, opts) {
|
---|
1850 | if (!node) return false;
|
---|
1851 | const nodeType = node.type;
|
---|
1852 |
|
---|
1853 | if (nodeType === "FunctionTypeAnnotation") {
|
---|
1854 | if (typeof opts === "undefined") {
|
---|
1855 | return true;
|
---|
1856 | } else {
|
---|
1857 | return (0, _shallowEqual.default)(node, opts);
|
---|
1858 | }
|
---|
1859 | }
|
---|
1860 |
|
---|
1861 | return false;
|
---|
1862 | }
|
---|
1863 |
|
---|
1864 | function isFunctionTypeParam(node, opts) {
|
---|
1865 | if (!node) return false;
|
---|
1866 | const nodeType = node.type;
|
---|
1867 |
|
---|
1868 | if (nodeType === "FunctionTypeParam") {
|
---|
1869 | if (typeof opts === "undefined") {
|
---|
1870 | return true;
|
---|
1871 | } else {
|
---|
1872 | return (0, _shallowEqual.default)(node, opts);
|
---|
1873 | }
|
---|
1874 | }
|
---|
1875 |
|
---|
1876 | return false;
|
---|
1877 | }
|
---|
1878 |
|
---|
1879 | function isGenericTypeAnnotation(node, opts) {
|
---|
1880 | if (!node) return false;
|
---|
1881 | const nodeType = node.type;
|
---|
1882 |
|
---|
1883 | if (nodeType === "GenericTypeAnnotation") {
|
---|
1884 | if (typeof opts === "undefined") {
|
---|
1885 | return true;
|
---|
1886 | } else {
|
---|
1887 | return (0, _shallowEqual.default)(node, opts);
|
---|
1888 | }
|
---|
1889 | }
|
---|
1890 |
|
---|
1891 | return false;
|
---|
1892 | }
|
---|
1893 |
|
---|
1894 | function isInferredPredicate(node, opts) {
|
---|
1895 | if (!node) return false;
|
---|
1896 | const nodeType = node.type;
|
---|
1897 |
|
---|
1898 | if (nodeType === "InferredPredicate") {
|
---|
1899 | if (typeof opts === "undefined") {
|
---|
1900 | return true;
|
---|
1901 | } else {
|
---|
1902 | return (0, _shallowEqual.default)(node, opts);
|
---|
1903 | }
|
---|
1904 | }
|
---|
1905 |
|
---|
1906 | return false;
|
---|
1907 | }
|
---|
1908 |
|
---|
1909 | function isInterfaceExtends(node, opts) {
|
---|
1910 | if (!node) return false;
|
---|
1911 | const nodeType = node.type;
|
---|
1912 |
|
---|
1913 | if (nodeType === "InterfaceExtends") {
|
---|
1914 | if (typeof opts === "undefined") {
|
---|
1915 | return true;
|
---|
1916 | } else {
|
---|
1917 | return (0, _shallowEqual.default)(node, opts);
|
---|
1918 | }
|
---|
1919 | }
|
---|
1920 |
|
---|
1921 | return false;
|
---|
1922 | }
|
---|
1923 |
|
---|
1924 | function isInterfaceDeclaration(node, opts) {
|
---|
1925 | if (!node) return false;
|
---|
1926 | const nodeType = node.type;
|
---|
1927 |
|
---|
1928 | if (nodeType === "InterfaceDeclaration") {
|
---|
1929 | if (typeof opts === "undefined") {
|
---|
1930 | return true;
|
---|
1931 | } else {
|
---|
1932 | return (0, _shallowEqual.default)(node, opts);
|
---|
1933 | }
|
---|
1934 | }
|
---|
1935 |
|
---|
1936 | return false;
|
---|
1937 | }
|
---|
1938 |
|
---|
1939 | function isInterfaceTypeAnnotation(node, opts) {
|
---|
1940 | if (!node) return false;
|
---|
1941 | const nodeType = node.type;
|
---|
1942 |
|
---|
1943 | if (nodeType === "InterfaceTypeAnnotation") {
|
---|
1944 | if (typeof opts === "undefined") {
|
---|
1945 | return true;
|
---|
1946 | } else {
|
---|
1947 | return (0, _shallowEqual.default)(node, opts);
|
---|
1948 | }
|
---|
1949 | }
|
---|
1950 |
|
---|
1951 | return false;
|
---|
1952 | }
|
---|
1953 |
|
---|
1954 | function isIntersectionTypeAnnotation(node, opts) {
|
---|
1955 | if (!node) return false;
|
---|
1956 | const nodeType = node.type;
|
---|
1957 |
|
---|
1958 | if (nodeType === "IntersectionTypeAnnotation") {
|
---|
1959 | if (typeof opts === "undefined") {
|
---|
1960 | return true;
|
---|
1961 | } else {
|
---|
1962 | return (0, _shallowEqual.default)(node, opts);
|
---|
1963 | }
|
---|
1964 | }
|
---|
1965 |
|
---|
1966 | return false;
|
---|
1967 | }
|
---|
1968 |
|
---|
1969 | function isMixedTypeAnnotation(node, opts) {
|
---|
1970 | if (!node) return false;
|
---|
1971 | const nodeType = node.type;
|
---|
1972 |
|
---|
1973 | if (nodeType === "MixedTypeAnnotation") {
|
---|
1974 | if (typeof opts === "undefined") {
|
---|
1975 | return true;
|
---|
1976 | } else {
|
---|
1977 | return (0, _shallowEqual.default)(node, opts);
|
---|
1978 | }
|
---|
1979 | }
|
---|
1980 |
|
---|
1981 | return false;
|
---|
1982 | }
|
---|
1983 |
|
---|
1984 | function isEmptyTypeAnnotation(node, opts) {
|
---|
1985 | if (!node) return false;
|
---|
1986 | const nodeType = node.type;
|
---|
1987 |
|
---|
1988 | if (nodeType === "EmptyTypeAnnotation") {
|
---|
1989 | if (typeof opts === "undefined") {
|
---|
1990 | return true;
|
---|
1991 | } else {
|
---|
1992 | return (0, _shallowEqual.default)(node, opts);
|
---|
1993 | }
|
---|
1994 | }
|
---|
1995 |
|
---|
1996 | return false;
|
---|
1997 | }
|
---|
1998 |
|
---|
1999 | function isNullableTypeAnnotation(node, opts) {
|
---|
2000 | if (!node) return false;
|
---|
2001 | const nodeType = node.type;
|
---|
2002 |
|
---|
2003 | if (nodeType === "NullableTypeAnnotation") {
|
---|
2004 | if (typeof opts === "undefined") {
|
---|
2005 | return true;
|
---|
2006 | } else {
|
---|
2007 | return (0, _shallowEqual.default)(node, opts);
|
---|
2008 | }
|
---|
2009 | }
|
---|
2010 |
|
---|
2011 | return false;
|
---|
2012 | }
|
---|
2013 |
|
---|
2014 | function isNumberLiteralTypeAnnotation(node, opts) {
|
---|
2015 | if (!node) return false;
|
---|
2016 | const nodeType = node.type;
|
---|
2017 |
|
---|
2018 | if (nodeType === "NumberLiteralTypeAnnotation") {
|
---|
2019 | if (typeof opts === "undefined") {
|
---|
2020 | return true;
|
---|
2021 | } else {
|
---|
2022 | return (0, _shallowEqual.default)(node, opts);
|
---|
2023 | }
|
---|
2024 | }
|
---|
2025 |
|
---|
2026 | return false;
|
---|
2027 | }
|
---|
2028 |
|
---|
2029 | function isNumberTypeAnnotation(node, opts) {
|
---|
2030 | if (!node) return false;
|
---|
2031 | const nodeType = node.type;
|
---|
2032 |
|
---|
2033 | if (nodeType === "NumberTypeAnnotation") {
|
---|
2034 | if (typeof opts === "undefined") {
|
---|
2035 | return true;
|
---|
2036 | } else {
|
---|
2037 | return (0, _shallowEqual.default)(node, opts);
|
---|
2038 | }
|
---|
2039 | }
|
---|
2040 |
|
---|
2041 | return false;
|
---|
2042 | }
|
---|
2043 |
|
---|
2044 | function isObjectTypeAnnotation(node, opts) {
|
---|
2045 | if (!node) return false;
|
---|
2046 | const nodeType = node.type;
|
---|
2047 |
|
---|
2048 | if (nodeType === "ObjectTypeAnnotation") {
|
---|
2049 | if (typeof opts === "undefined") {
|
---|
2050 | return true;
|
---|
2051 | } else {
|
---|
2052 | return (0, _shallowEqual.default)(node, opts);
|
---|
2053 | }
|
---|
2054 | }
|
---|
2055 |
|
---|
2056 | return false;
|
---|
2057 | }
|
---|
2058 |
|
---|
2059 | function isObjectTypeInternalSlot(node, opts) {
|
---|
2060 | if (!node) return false;
|
---|
2061 | const nodeType = node.type;
|
---|
2062 |
|
---|
2063 | if (nodeType === "ObjectTypeInternalSlot") {
|
---|
2064 | if (typeof opts === "undefined") {
|
---|
2065 | return true;
|
---|
2066 | } else {
|
---|
2067 | return (0, _shallowEqual.default)(node, opts);
|
---|
2068 | }
|
---|
2069 | }
|
---|
2070 |
|
---|
2071 | return false;
|
---|
2072 | }
|
---|
2073 |
|
---|
2074 | function isObjectTypeCallProperty(node, opts) {
|
---|
2075 | if (!node) return false;
|
---|
2076 | const nodeType = node.type;
|
---|
2077 |
|
---|
2078 | if (nodeType === "ObjectTypeCallProperty") {
|
---|
2079 | if (typeof opts === "undefined") {
|
---|
2080 | return true;
|
---|
2081 | } else {
|
---|
2082 | return (0, _shallowEqual.default)(node, opts);
|
---|
2083 | }
|
---|
2084 | }
|
---|
2085 |
|
---|
2086 | return false;
|
---|
2087 | }
|
---|
2088 |
|
---|
2089 | function isObjectTypeIndexer(node, opts) {
|
---|
2090 | if (!node) return false;
|
---|
2091 | const nodeType = node.type;
|
---|
2092 |
|
---|
2093 | if (nodeType === "ObjectTypeIndexer") {
|
---|
2094 | if (typeof opts === "undefined") {
|
---|
2095 | return true;
|
---|
2096 | } else {
|
---|
2097 | return (0, _shallowEqual.default)(node, opts);
|
---|
2098 | }
|
---|
2099 | }
|
---|
2100 |
|
---|
2101 | return false;
|
---|
2102 | }
|
---|
2103 |
|
---|
2104 | function isObjectTypeProperty(node, opts) {
|
---|
2105 | if (!node) return false;
|
---|
2106 | const nodeType = node.type;
|
---|
2107 |
|
---|
2108 | if (nodeType === "ObjectTypeProperty") {
|
---|
2109 | if (typeof opts === "undefined") {
|
---|
2110 | return true;
|
---|
2111 | } else {
|
---|
2112 | return (0, _shallowEqual.default)(node, opts);
|
---|
2113 | }
|
---|
2114 | }
|
---|
2115 |
|
---|
2116 | return false;
|
---|
2117 | }
|
---|
2118 |
|
---|
2119 | function isObjectTypeSpreadProperty(node, opts) {
|
---|
2120 | if (!node) return false;
|
---|
2121 | const nodeType = node.type;
|
---|
2122 |
|
---|
2123 | if (nodeType === "ObjectTypeSpreadProperty") {
|
---|
2124 | if (typeof opts === "undefined") {
|
---|
2125 | return true;
|
---|
2126 | } else {
|
---|
2127 | return (0, _shallowEqual.default)(node, opts);
|
---|
2128 | }
|
---|
2129 | }
|
---|
2130 |
|
---|
2131 | return false;
|
---|
2132 | }
|
---|
2133 |
|
---|
2134 | function isOpaqueType(node, opts) {
|
---|
2135 | if (!node) return false;
|
---|
2136 | const nodeType = node.type;
|
---|
2137 |
|
---|
2138 | if (nodeType === "OpaqueType") {
|
---|
2139 | if (typeof opts === "undefined") {
|
---|
2140 | return true;
|
---|
2141 | } else {
|
---|
2142 | return (0, _shallowEqual.default)(node, opts);
|
---|
2143 | }
|
---|
2144 | }
|
---|
2145 |
|
---|
2146 | return false;
|
---|
2147 | }
|
---|
2148 |
|
---|
2149 | function isQualifiedTypeIdentifier(node, opts) {
|
---|
2150 | if (!node) return false;
|
---|
2151 | const nodeType = node.type;
|
---|
2152 |
|
---|
2153 | if (nodeType === "QualifiedTypeIdentifier") {
|
---|
2154 | if (typeof opts === "undefined") {
|
---|
2155 | return true;
|
---|
2156 | } else {
|
---|
2157 | return (0, _shallowEqual.default)(node, opts);
|
---|
2158 | }
|
---|
2159 | }
|
---|
2160 |
|
---|
2161 | return false;
|
---|
2162 | }
|
---|
2163 |
|
---|
2164 | function isStringLiteralTypeAnnotation(node, opts) {
|
---|
2165 | if (!node) return false;
|
---|
2166 | const nodeType = node.type;
|
---|
2167 |
|
---|
2168 | if (nodeType === "StringLiteralTypeAnnotation") {
|
---|
2169 | if (typeof opts === "undefined") {
|
---|
2170 | return true;
|
---|
2171 | } else {
|
---|
2172 | return (0, _shallowEqual.default)(node, opts);
|
---|
2173 | }
|
---|
2174 | }
|
---|
2175 |
|
---|
2176 | return false;
|
---|
2177 | }
|
---|
2178 |
|
---|
2179 | function isStringTypeAnnotation(node, opts) {
|
---|
2180 | if (!node) return false;
|
---|
2181 | const nodeType = node.type;
|
---|
2182 |
|
---|
2183 | if (nodeType === "StringTypeAnnotation") {
|
---|
2184 | if (typeof opts === "undefined") {
|
---|
2185 | return true;
|
---|
2186 | } else {
|
---|
2187 | return (0, _shallowEqual.default)(node, opts);
|
---|
2188 | }
|
---|
2189 | }
|
---|
2190 |
|
---|
2191 | return false;
|
---|
2192 | }
|
---|
2193 |
|
---|
2194 | function isSymbolTypeAnnotation(node, opts) {
|
---|
2195 | if (!node) return false;
|
---|
2196 | const nodeType = node.type;
|
---|
2197 |
|
---|
2198 | if (nodeType === "SymbolTypeAnnotation") {
|
---|
2199 | if (typeof opts === "undefined") {
|
---|
2200 | return true;
|
---|
2201 | } else {
|
---|
2202 | return (0, _shallowEqual.default)(node, opts);
|
---|
2203 | }
|
---|
2204 | }
|
---|
2205 |
|
---|
2206 | return false;
|
---|
2207 | }
|
---|
2208 |
|
---|
2209 | function isThisTypeAnnotation(node, opts) {
|
---|
2210 | if (!node) return false;
|
---|
2211 | const nodeType = node.type;
|
---|
2212 |
|
---|
2213 | if (nodeType === "ThisTypeAnnotation") {
|
---|
2214 | if (typeof opts === "undefined") {
|
---|
2215 | return true;
|
---|
2216 | } else {
|
---|
2217 | return (0, _shallowEqual.default)(node, opts);
|
---|
2218 | }
|
---|
2219 | }
|
---|
2220 |
|
---|
2221 | return false;
|
---|
2222 | }
|
---|
2223 |
|
---|
2224 | function isTupleTypeAnnotation(node, opts) {
|
---|
2225 | if (!node) return false;
|
---|
2226 | const nodeType = node.type;
|
---|
2227 |
|
---|
2228 | if (nodeType === "TupleTypeAnnotation") {
|
---|
2229 | if (typeof opts === "undefined") {
|
---|
2230 | return true;
|
---|
2231 | } else {
|
---|
2232 | return (0, _shallowEqual.default)(node, opts);
|
---|
2233 | }
|
---|
2234 | }
|
---|
2235 |
|
---|
2236 | return false;
|
---|
2237 | }
|
---|
2238 |
|
---|
2239 | function isTypeofTypeAnnotation(node, opts) {
|
---|
2240 | if (!node) return false;
|
---|
2241 | const nodeType = node.type;
|
---|
2242 |
|
---|
2243 | if (nodeType === "TypeofTypeAnnotation") {
|
---|
2244 | if (typeof opts === "undefined") {
|
---|
2245 | return true;
|
---|
2246 | } else {
|
---|
2247 | return (0, _shallowEqual.default)(node, opts);
|
---|
2248 | }
|
---|
2249 | }
|
---|
2250 |
|
---|
2251 | return false;
|
---|
2252 | }
|
---|
2253 |
|
---|
2254 | function isTypeAlias(node, opts) {
|
---|
2255 | if (!node) return false;
|
---|
2256 | const nodeType = node.type;
|
---|
2257 |
|
---|
2258 | if (nodeType === "TypeAlias") {
|
---|
2259 | if (typeof opts === "undefined") {
|
---|
2260 | return true;
|
---|
2261 | } else {
|
---|
2262 | return (0, _shallowEqual.default)(node, opts);
|
---|
2263 | }
|
---|
2264 | }
|
---|
2265 |
|
---|
2266 | return false;
|
---|
2267 | }
|
---|
2268 |
|
---|
2269 | function isTypeAnnotation(node, opts) {
|
---|
2270 | if (!node) return false;
|
---|
2271 | const nodeType = node.type;
|
---|
2272 |
|
---|
2273 | if (nodeType === "TypeAnnotation") {
|
---|
2274 | if (typeof opts === "undefined") {
|
---|
2275 | return true;
|
---|
2276 | } else {
|
---|
2277 | return (0, _shallowEqual.default)(node, opts);
|
---|
2278 | }
|
---|
2279 | }
|
---|
2280 |
|
---|
2281 | return false;
|
---|
2282 | }
|
---|
2283 |
|
---|
2284 | function isTypeCastExpression(node, opts) {
|
---|
2285 | if (!node) return false;
|
---|
2286 | const nodeType = node.type;
|
---|
2287 |
|
---|
2288 | if (nodeType === "TypeCastExpression") {
|
---|
2289 | if (typeof opts === "undefined") {
|
---|
2290 | return true;
|
---|
2291 | } else {
|
---|
2292 | return (0, _shallowEqual.default)(node, opts);
|
---|
2293 | }
|
---|
2294 | }
|
---|
2295 |
|
---|
2296 | return false;
|
---|
2297 | }
|
---|
2298 |
|
---|
2299 | function isTypeParameter(node, opts) {
|
---|
2300 | if (!node) return false;
|
---|
2301 | const nodeType = node.type;
|
---|
2302 |
|
---|
2303 | if (nodeType === "TypeParameter") {
|
---|
2304 | if (typeof opts === "undefined") {
|
---|
2305 | return true;
|
---|
2306 | } else {
|
---|
2307 | return (0, _shallowEqual.default)(node, opts);
|
---|
2308 | }
|
---|
2309 | }
|
---|
2310 |
|
---|
2311 | return false;
|
---|
2312 | }
|
---|
2313 |
|
---|
2314 | function isTypeParameterDeclaration(node, opts) {
|
---|
2315 | if (!node) return false;
|
---|
2316 | const nodeType = node.type;
|
---|
2317 |
|
---|
2318 | if (nodeType === "TypeParameterDeclaration") {
|
---|
2319 | if (typeof opts === "undefined") {
|
---|
2320 | return true;
|
---|
2321 | } else {
|
---|
2322 | return (0, _shallowEqual.default)(node, opts);
|
---|
2323 | }
|
---|
2324 | }
|
---|
2325 |
|
---|
2326 | return false;
|
---|
2327 | }
|
---|
2328 |
|
---|
2329 | function isTypeParameterInstantiation(node, opts) {
|
---|
2330 | if (!node) return false;
|
---|
2331 | const nodeType = node.type;
|
---|
2332 |
|
---|
2333 | if (nodeType === "TypeParameterInstantiation") {
|
---|
2334 | if (typeof opts === "undefined") {
|
---|
2335 | return true;
|
---|
2336 | } else {
|
---|
2337 | return (0, _shallowEqual.default)(node, opts);
|
---|
2338 | }
|
---|
2339 | }
|
---|
2340 |
|
---|
2341 | return false;
|
---|
2342 | }
|
---|
2343 |
|
---|
2344 | function isUnionTypeAnnotation(node, opts) {
|
---|
2345 | if (!node) return false;
|
---|
2346 | const nodeType = node.type;
|
---|
2347 |
|
---|
2348 | if (nodeType === "UnionTypeAnnotation") {
|
---|
2349 | if (typeof opts === "undefined") {
|
---|
2350 | return true;
|
---|
2351 | } else {
|
---|
2352 | return (0, _shallowEqual.default)(node, opts);
|
---|
2353 | }
|
---|
2354 | }
|
---|
2355 |
|
---|
2356 | return false;
|
---|
2357 | }
|
---|
2358 |
|
---|
2359 | function isVariance(node, opts) {
|
---|
2360 | if (!node) return false;
|
---|
2361 | const nodeType = node.type;
|
---|
2362 |
|
---|
2363 | if (nodeType === "Variance") {
|
---|
2364 | if (typeof opts === "undefined") {
|
---|
2365 | return true;
|
---|
2366 | } else {
|
---|
2367 | return (0, _shallowEqual.default)(node, opts);
|
---|
2368 | }
|
---|
2369 | }
|
---|
2370 |
|
---|
2371 | return false;
|
---|
2372 | }
|
---|
2373 |
|
---|
2374 | function isVoidTypeAnnotation(node, opts) {
|
---|
2375 | if (!node) return false;
|
---|
2376 | const nodeType = node.type;
|
---|
2377 |
|
---|
2378 | if (nodeType === "VoidTypeAnnotation") {
|
---|
2379 | if (typeof opts === "undefined") {
|
---|
2380 | return true;
|
---|
2381 | } else {
|
---|
2382 | return (0, _shallowEqual.default)(node, opts);
|
---|
2383 | }
|
---|
2384 | }
|
---|
2385 |
|
---|
2386 | return false;
|
---|
2387 | }
|
---|
2388 |
|
---|
2389 | function isEnumDeclaration(node, opts) {
|
---|
2390 | if (!node) return false;
|
---|
2391 | const nodeType = node.type;
|
---|
2392 |
|
---|
2393 | if (nodeType === "EnumDeclaration") {
|
---|
2394 | if (typeof opts === "undefined") {
|
---|
2395 | return true;
|
---|
2396 | } else {
|
---|
2397 | return (0, _shallowEqual.default)(node, opts);
|
---|
2398 | }
|
---|
2399 | }
|
---|
2400 |
|
---|
2401 | return false;
|
---|
2402 | }
|
---|
2403 |
|
---|
2404 | function isEnumBooleanBody(node, opts) {
|
---|
2405 | if (!node) return false;
|
---|
2406 | const nodeType = node.type;
|
---|
2407 |
|
---|
2408 | if (nodeType === "EnumBooleanBody") {
|
---|
2409 | if (typeof opts === "undefined") {
|
---|
2410 | return true;
|
---|
2411 | } else {
|
---|
2412 | return (0, _shallowEqual.default)(node, opts);
|
---|
2413 | }
|
---|
2414 | }
|
---|
2415 |
|
---|
2416 | return false;
|
---|
2417 | }
|
---|
2418 |
|
---|
2419 | function isEnumNumberBody(node, opts) {
|
---|
2420 | if (!node) return false;
|
---|
2421 | const nodeType = node.type;
|
---|
2422 |
|
---|
2423 | if (nodeType === "EnumNumberBody") {
|
---|
2424 | if (typeof opts === "undefined") {
|
---|
2425 | return true;
|
---|
2426 | } else {
|
---|
2427 | return (0, _shallowEqual.default)(node, opts);
|
---|
2428 | }
|
---|
2429 | }
|
---|
2430 |
|
---|
2431 | return false;
|
---|
2432 | }
|
---|
2433 |
|
---|
2434 | function isEnumStringBody(node, opts) {
|
---|
2435 | if (!node) return false;
|
---|
2436 | const nodeType = node.type;
|
---|
2437 |
|
---|
2438 | if (nodeType === "EnumStringBody") {
|
---|
2439 | if (typeof opts === "undefined") {
|
---|
2440 | return true;
|
---|
2441 | } else {
|
---|
2442 | return (0, _shallowEqual.default)(node, opts);
|
---|
2443 | }
|
---|
2444 | }
|
---|
2445 |
|
---|
2446 | return false;
|
---|
2447 | }
|
---|
2448 |
|
---|
2449 | function isEnumSymbolBody(node, opts) {
|
---|
2450 | if (!node) return false;
|
---|
2451 | const nodeType = node.type;
|
---|
2452 |
|
---|
2453 | if (nodeType === "EnumSymbolBody") {
|
---|
2454 | if (typeof opts === "undefined") {
|
---|
2455 | return true;
|
---|
2456 | } else {
|
---|
2457 | return (0, _shallowEqual.default)(node, opts);
|
---|
2458 | }
|
---|
2459 | }
|
---|
2460 |
|
---|
2461 | return false;
|
---|
2462 | }
|
---|
2463 |
|
---|
2464 | function isEnumBooleanMember(node, opts) {
|
---|
2465 | if (!node) return false;
|
---|
2466 | const nodeType = node.type;
|
---|
2467 |
|
---|
2468 | if (nodeType === "EnumBooleanMember") {
|
---|
2469 | if (typeof opts === "undefined") {
|
---|
2470 | return true;
|
---|
2471 | } else {
|
---|
2472 | return (0, _shallowEqual.default)(node, opts);
|
---|
2473 | }
|
---|
2474 | }
|
---|
2475 |
|
---|
2476 | return false;
|
---|
2477 | }
|
---|
2478 |
|
---|
2479 | function isEnumNumberMember(node, opts) {
|
---|
2480 | if (!node) return false;
|
---|
2481 | const nodeType = node.type;
|
---|
2482 |
|
---|
2483 | if (nodeType === "EnumNumberMember") {
|
---|
2484 | if (typeof opts === "undefined") {
|
---|
2485 | return true;
|
---|
2486 | } else {
|
---|
2487 | return (0, _shallowEqual.default)(node, opts);
|
---|
2488 | }
|
---|
2489 | }
|
---|
2490 |
|
---|
2491 | return false;
|
---|
2492 | }
|
---|
2493 |
|
---|
2494 | function isEnumStringMember(node, opts) {
|
---|
2495 | if (!node) return false;
|
---|
2496 | const nodeType = node.type;
|
---|
2497 |
|
---|
2498 | if (nodeType === "EnumStringMember") {
|
---|
2499 | if (typeof opts === "undefined") {
|
---|
2500 | return true;
|
---|
2501 | } else {
|
---|
2502 | return (0, _shallowEqual.default)(node, opts);
|
---|
2503 | }
|
---|
2504 | }
|
---|
2505 |
|
---|
2506 | return false;
|
---|
2507 | }
|
---|
2508 |
|
---|
2509 | function isEnumDefaultedMember(node, opts) {
|
---|
2510 | if (!node) return false;
|
---|
2511 | const nodeType = node.type;
|
---|
2512 |
|
---|
2513 | if (nodeType === "EnumDefaultedMember") {
|
---|
2514 | if (typeof opts === "undefined") {
|
---|
2515 | return true;
|
---|
2516 | } else {
|
---|
2517 | return (0, _shallowEqual.default)(node, opts);
|
---|
2518 | }
|
---|
2519 | }
|
---|
2520 |
|
---|
2521 | return false;
|
---|
2522 | }
|
---|
2523 |
|
---|
2524 | function isIndexedAccessType(node, opts) {
|
---|
2525 | if (!node) return false;
|
---|
2526 | const nodeType = node.type;
|
---|
2527 |
|
---|
2528 | if (nodeType === "IndexedAccessType") {
|
---|
2529 | if (typeof opts === "undefined") {
|
---|
2530 | return true;
|
---|
2531 | } else {
|
---|
2532 | return (0, _shallowEqual.default)(node, opts);
|
---|
2533 | }
|
---|
2534 | }
|
---|
2535 |
|
---|
2536 | return false;
|
---|
2537 | }
|
---|
2538 |
|
---|
2539 | function isOptionalIndexedAccessType(node, opts) {
|
---|
2540 | if (!node) return false;
|
---|
2541 | const nodeType = node.type;
|
---|
2542 |
|
---|
2543 | if (nodeType === "OptionalIndexedAccessType") {
|
---|
2544 | if (typeof opts === "undefined") {
|
---|
2545 | return true;
|
---|
2546 | } else {
|
---|
2547 | return (0, _shallowEqual.default)(node, opts);
|
---|
2548 | }
|
---|
2549 | }
|
---|
2550 |
|
---|
2551 | return false;
|
---|
2552 | }
|
---|
2553 |
|
---|
2554 | function isJSXAttribute(node, opts) {
|
---|
2555 | if (!node) return false;
|
---|
2556 | const nodeType = node.type;
|
---|
2557 |
|
---|
2558 | if (nodeType === "JSXAttribute") {
|
---|
2559 | if (typeof opts === "undefined") {
|
---|
2560 | return true;
|
---|
2561 | } else {
|
---|
2562 | return (0, _shallowEqual.default)(node, opts);
|
---|
2563 | }
|
---|
2564 | }
|
---|
2565 |
|
---|
2566 | return false;
|
---|
2567 | }
|
---|
2568 |
|
---|
2569 | function isJSXClosingElement(node, opts) {
|
---|
2570 | if (!node) return false;
|
---|
2571 | const nodeType = node.type;
|
---|
2572 |
|
---|
2573 | if (nodeType === "JSXClosingElement") {
|
---|
2574 | if (typeof opts === "undefined") {
|
---|
2575 | return true;
|
---|
2576 | } else {
|
---|
2577 | return (0, _shallowEqual.default)(node, opts);
|
---|
2578 | }
|
---|
2579 | }
|
---|
2580 |
|
---|
2581 | return false;
|
---|
2582 | }
|
---|
2583 |
|
---|
2584 | function isJSXElement(node, opts) {
|
---|
2585 | if (!node) return false;
|
---|
2586 | const nodeType = node.type;
|
---|
2587 |
|
---|
2588 | if (nodeType === "JSXElement") {
|
---|
2589 | if (typeof opts === "undefined") {
|
---|
2590 | return true;
|
---|
2591 | } else {
|
---|
2592 | return (0, _shallowEqual.default)(node, opts);
|
---|
2593 | }
|
---|
2594 | }
|
---|
2595 |
|
---|
2596 | return false;
|
---|
2597 | }
|
---|
2598 |
|
---|
2599 | function isJSXEmptyExpression(node, opts) {
|
---|
2600 | if (!node) return false;
|
---|
2601 | const nodeType = node.type;
|
---|
2602 |
|
---|
2603 | if (nodeType === "JSXEmptyExpression") {
|
---|
2604 | if (typeof opts === "undefined") {
|
---|
2605 | return true;
|
---|
2606 | } else {
|
---|
2607 | return (0, _shallowEqual.default)(node, opts);
|
---|
2608 | }
|
---|
2609 | }
|
---|
2610 |
|
---|
2611 | return false;
|
---|
2612 | }
|
---|
2613 |
|
---|
2614 | function isJSXExpressionContainer(node, opts) {
|
---|
2615 | if (!node) return false;
|
---|
2616 | const nodeType = node.type;
|
---|
2617 |
|
---|
2618 | if (nodeType === "JSXExpressionContainer") {
|
---|
2619 | if (typeof opts === "undefined") {
|
---|
2620 | return true;
|
---|
2621 | } else {
|
---|
2622 | return (0, _shallowEqual.default)(node, opts);
|
---|
2623 | }
|
---|
2624 | }
|
---|
2625 |
|
---|
2626 | return false;
|
---|
2627 | }
|
---|
2628 |
|
---|
2629 | function isJSXSpreadChild(node, opts) {
|
---|
2630 | if (!node) return false;
|
---|
2631 | const nodeType = node.type;
|
---|
2632 |
|
---|
2633 | if (nodeType === "JSXSpreadChild") {
|
---|
2634 | if (typeof opts === "undefined") {
|
---|
2635 | return true;
|
---|
2636 | } else {
|
---|
2637 | return (0, _shallowEqual.default)(node, opts);
|
---|
2638 | }
|
---|
2639 | }
|
---|
2640 |
|
---|
2641 | return false;
|
---|
2642 | }
|
---|
2643 |
|
---|
2644 | function isJSXIdentifier(node, opts) {
|
---|
2645 | if (!node) return false;
|
---|
2646 | const nodeType = node.type;
|
---|
2647 |
|
---|
2648 | if (nodeType === "JSXIdentifier") {
|
---|
2649 | if (typeof opts === "undefined") {
|
---|
2650 | return true;
|
---|
2651 | } else {
|
---|
2652 | return (0, _shallowEqual.default)(node, opts);
|
---|
2653 | }
|
---|
2654 | }
|
---|
2655 |
|
---|
2656 | return false;
|
---|
2657 | }
|
---|
2658 |
|
---|
2659 | function isJSXMemberExpression(node, opts) {
|
---|
2660 | if (!node) return false;
|
---|
2661 | const nodeType = node.type;
|
---|
2662 |
|
---|
2663 | if (nodeType === "JSXMemberExpression") {
|
---|
2664 | if (typeof opts === "undefined") {
|
---|
2665 | return true;
|
---|
2666 | } else {
|
---|
2667 | return (0, _shallowEqual.default)(node, opts);
|
---|
2668 | }
|
---|
2669 | }
|
---|
2670 |
|
---|
2671 | return false;
|
---|
2672 | }
|
---|
2673 |
|
---|
2674 | function isJSXNamespacedName(node, opts) {
|
---|
2675 | if (!node) return false;
|
---|
2676 | const nodeType = node.type;
|
---|
2677 |
|
---|
2678 | if (nodeType === "JSXNamespacedName") {
|
---|
2679 | if (typeof opts === "undefined") {
|
---|
2680 | return true;
|
---|
2681 | } else {
|
---|
2682 | return (0, _shallowEqual.default)(node, opts);
|
---|
2683 | }
|
---|
2684 | }
|
---|
2685 |
|
---|
2686 | return false;
|
---|
2687 | }
|
---|
2688 |
|
---|
2689 | function isJSXOpeningElement(node, opts) {
|
---|
2690 | if (!node) return false;
|
---|
2691 | const nodeType = node.type;
|
---|
2692 |
|
---|
2693 | if (nodeType === "JSXOpeningElement") {
|
---|
2694 | if (typeof opts === "undefined") {
|
---|
2695 | return true;
|
---|
2696 | } else {
|
---|
2697 | return (0, _shallowEqual.default)(node, opts);
|
---|
2698 | }
|
---|
2699 | }
|
---|
2700 |
|
---|
2701 | return false;
|
---|
2702 | }
|
---|
2703 |
|
---|
2704 | function isJSXSpreadAttribute(node, opts) {
|
---|
2705 | if (!node) return false;
|
---|
2706 | const nodeType = node.type;
|
---|
2707 |
|
---|
2708 | if (nodeType === "JSXSpreadAttribute") {
|
---|
2709 | if (typeof opts === "undefined") {
|
---|
2710 | return true;
|
---|
2711 | } else {
|
---|
2712 | return (0, _shallowEqual.default)(node, opts);
|
---|
2713 | }
|
---|
2714 | }
|
---|
2715 |
|
---|
2716 | return false;
|
---|
2717 | }
|
---|
2718 |
|
---|
2719 | function isJSXText(node, opts) {
|
---|
2720 | if (!node) return false;
|
---|
2721 | const nodeType = node.type;
|
---|
2722 |
|
---|
2723 | if (nodeType === "JSXText") {
|
---|
2724 | if (typeof opts === "undefined") {
|
---|
2725 | return true;
|
---|
2726 | } else {
|
---|
2727 | return (0, _shallowEqual.default)(node, opts);
|
---|
2728 | }
|
---|
2729 | }
|
---|
2730 |
|
---|
2731 | return false;
|
---|
2732 | }
|
---|
2733 |
|
---|
2734 | function isJSXFragment(node, opts) {
|
---|
2735 | if (!node) return false;
|
---|
2736 | const nodeType = node.type;
|
---|
2737 |
|
---|
2738 | if (nodeType === "JSXFragment") {
|
---|
2739 | if (typeof opts === "undefined") {
|
---|
2740 | return true;
|
---|
2741 | } else {
|
---|
2742 | return (0, _shallowEqual.default)(node, opts);
|
---|
2743 | }
|
---|
2744 | }
|
---|
2745 |
|
---|
2746 | return false;
|
---|
2747 | }
|
---|
2748 |
|
---|
2749 | function isJSXOpeningFragment(node, opts) {
|
---|
2750 | if (!node) return false;
|
---|
2751 | const nodeType = node.type;
|
---|
2752 |
|
---|
2753 | if (nodeType === "JSXOpeningFragment") {
|
---|
2754 | if (typeof opts === "undefined") {
|
---|
2755 | return true;
|
---|
2756 | } else {
|
---|
2757 | return (0, _shallowEqual.default)(node, opts);
|
---|
2758 | }
|
---|
2759 | }
|
---|
2760 |
|
---|
2761 | return false;
|
---|
2762 | }
|
---|
2763 |
|
---|
2764 | function isJSXClosingFragment(node, opts) {
|
---|
2765 | if (!node) return false;
|
---|
2766 | const nodeType = node.type;
|
---|
2767 |
|
---|
2768 | if (nodeType === "JSXClosingFragment") {
|
---|
2769 | if (typeof opts === "undefined") {
|
---|
2770 | return true;
|
---|
2771 | } else {
|
---|
2772 | return (0, _shallowEqual.default)(node, opts);
|
---|
2773 | }
|
---|
2774 | }
|
---|
2775 |
|
---|
2776 | return false;
|
---|
2777 | }
|
---|
2778 |
|
---|
2779 | function isNoop(node, opts) {
|
---|
2780 | if (!node) return false;
|
---|
2781 | const nodeType = node.type;
|
---|
2782 |
|
---|
2783 | if (nodeType === "Noop") {
|
---|
2784 | if (typeof opts === "undefined") {
|
---|
2785 | return true;
|
---|
2786 | } else {
|
---|
2787 | return (0, _shallowEqual.default)(node, opts);
|
---|
2788 | }
|
---|
2789 | }
|
---|
2790 |
|
---|
2791 | return false;
|
---|
2792 | }
|
---|
2793 |
|
---|
2794 | function isPlaceholder(node, opts) {
|
---|
2795 | if (!node) return false;
|
---|
2796 | const nodeType = node.type;
|
---|
2797 |
|
---|
2798 | if (nodeType === "Placeholder") {
|
---|
2799 | if (typeof opts === "undefined") {
|
---|
2800 | return true;
|
---|
2801 | } else {
|
---|
2802 | return (0, _shallowEqual.default)(node, opts);
|
---|
2803 | }
|
---|
2804 | }
|
---|
2805 |
|
---|
2806 | return false;
|
---|
2807 | }
|
---|
2808 |
|
---|
2809 | function isV8IntrinsicIdentifier(node, opts) {
|
---|
2810 | if (!node) return false;
|
---|
2811 | const nodeType = node.type;
|
---|
2812 |
|
---|
2813 | if (nodeType === "V8IntrinsicIdentifier") {
|
---|
2814 | if (typeof opts === "undefined") {
|
---|
2815 | return true;
|
---|
2816 | } else {
|
---|
2817 | return (0, _shallowEqual.default)(node, opts);
|
---|
2818 | }
|
---|
2819 | }
|
---|
2820 |
|
---|
2821 | return false;
|
---|
2822 | }
|
---|
2823 |
|
---|
2824 | function isArgumentPlaceholder(node, opts) {
|
---|
2825 | if (!node) return false;
|
---|
2826 | const nodeType = node.type;
|
---|
2827 |
|
---|
2828 | if (nodeType === "ArgumentPlaceholder") {
|
---|
2829 | if (typeof opts === "undefined") {
|
---|
2830 | return true;
|
---|
2831 | } else {
|
---|
2832 | return (0, _shallowEqual.default)(node, opts);
|
---|
2833 | }
|
---|
2834 | }
|
---|
2835 |
|
---|
2836 | return false;
|
---|
2837 | }
|
---|
2838 |
|
---|
2839 | function isBindExpression(node, opts) {
|
---|
2840 | if (!node) return false;
|
---|
2841 | const nodeType = node.type;
|
---|
2842 |
|
---|
2843 | if (nodeType === "BindExpression") {
|
---|
2844 | if (typeof opts === "undefined") {
|
---|
2845 | return true;
|
---|
2846 | } else {
|
---|
2847 | return (0, _shallowEqual.default)(node, opts);
|
---|
2848 | }
|
---|
2849 | }
|
---|
2850 |
|
---|
2851 | return false;
|
---|
2852 | }
|
---|
2853 |
|
---|
2854 | function isImportAttribute(node, opts) {
|
---|
2855 | if (!node) return false;
|
---|
2856 | const nodeType = node.type;
|
---|
2857 |
|
---|
2858 | if (nodeType === "ImportAttribute") {
|
---|
2859 | if (typeof opts === "undefined") {
|
---|
2860 | return true;
|
---|
2861 | } else {
|
---|
2862 | return (0, _shallowEqual.default)(node, opts);
|
---|
2863 | }
|
---|
2864 | }
|
---|
2865 |
|
---|
2866 | return false;
|
---|
2867 | }
|
---|
2868 |
|
---|
2869 | function isDecorator(node, opts) {
|
---|
2870 | if (!node) return false;
|
---|
2871 | const nodeType = node.type;
|
---|
2872 |
|
---|
2873 | if (nodeType === "Decorator") {
|
---|
2874 | if (typeof opts === "undefined") {
|
---|
2875 | return true;
|
---|
2876 | } else {
|
---|
2877 | return (0, _shallowEqual.default)(node, opts);
|
---|
2878 | }
|
---|
2879 | }
|
---|
2880 |
|
---|
2881 | return false;
|
---|
2882 | }
|
---|
2883 |
|
---|
2884 | function isDoExpression(node, opts) {
|
---|
2885 | if (!node) return false;
|
---|
2886 | const nodeType = node.type;
|
---|
2887 |
|
---|
2888 | if (nodeType === "DoExpression") {
|
---|
2889 | if (typeof opts === "undefined") {
|
---|
2890 | return true;
|
---|
2891 | } else {
|
---|
2892 | return (0, _shallowEqual.default)(node, opts);
|
---|
2893 | }
|
---|
2894 | }
|
---|
2895 |
|
---|
2896 | return false;
|
---|
2897 | }
|
---|
2898 |
|
---|
2899 | function isExportDefaultSpecifier(node, opts) {
|
---|
2900 | if (!node) return false;
|
---|
2901 | const nodeType = node.type;
|
---|
2902 |
|
---|
2903 | if (nodeType === "ExportDefaultSpecifier") {
|
---|
2904 | if (typeof opts === "undefined") {
|
---|
2905 | return true;
|
---|
2906 | } else {
|
---|
2907 | return (0, _shallowEqual.default)(node, opts);
|
---|
2908 | }
|
---|
2909 | }
|
---|
2910 |
|
---|
2911 | return false;
|
---|
2912 | }
|
---|
2913 |
|
---|
2914 | function isRecordExpression(node, opts) {
|
---|
2915 | if (!node) return false;
|
---|
2916 | const nodeType = node.type;
|
---|
2917 |
|
---|
2918 | if (nodeType === "RecordExpression") {
|
---|
2919 | if (typeof opts === "undefined") {
|
---|
2920 | return true;
|
---|
2921 | } else {
|
---|
2922 | return (0, _shallowEqual.default)(node, opts);
|
---|
2923 | }
|
---|
2924 | }
|
---|
2925 |
|
---|
2926 | return false;
|
---|
2927 | }
|
---|
2928 |
|
---|
2929 | function isTupleExpression(node, opts) {
|
---|
2930 | if (!node) return false;
|
---|
2931 | const nodeType = node.type;
|
---|
2932 |
|
---|
2933 | if (nodeType === "TupleExpression") {
|
---|
2934 | if (typeof opts === "undefined") {
|
---|
2935 | return true;
|
---|
2936 | } else {
|
---|
2937 | return (0, _shallowEqual.default)(node, opts);
|
---|
2938 | }
|
---|
2939 | }
|
---|
2940 |
|
---|
2941 | return false;
|
---|
2942 | }
|
---|
2943 |
|
---|
2944 | function isDecimalLiteral(node, opts) {
|
---|
2945 | if (!node) return false;
|
---|
2946 | const nodeType = node.type;
|
---|
2947 |
|
---|
2948 | if (nodeType === "DecimalLiteral") {
|
---|
2949 | if (typeof opts === "undefined") {
|
---|
2950 | return true;
|
---|
2951 | } else {
|
---|
2952 | return (0, _shallowEqual.default)(node, opts);
|
---|
2953 | }
|
---|
2954 | }
|
---|
2955 |
|
---|
2956 | return false;
|
---|
2957 | }
|
---|
2958 |
|
---|
2959 | function isStaticBlock(node, opts) {
|
---|
2960 | if (!node) return false;
|
---|
2961 | const nodeType = node.type;
|
---|
2962 |
|
---|
2963 | if (nodeType === "StaticBlock") {
|
---|
2964 | if (typeof opts === "undefined") {
|
---|
2965 | return true;
|
---|
2966 | } else {
|
---|
2967 | return (0, _shallowEqual.default)(node, opts);
|
---|
2968 | }
|
---|
2969 | }
|
---|
2970 |
|
---|
2971 | return false;
|
---|
2972 | }
|
---|
2973 |
|
---|
2974 | function isModuleExpression(node, opts) {
|
---|
2975 | if (!node) return false;
|
---|
2976 | const nodeType = node.type;
|
---|
2977 |
|
---|
2978 | if (nodeType === "ModuleExpression") {
|
---|
2979 | if (typeof opts === "undefined") {
|
---|
2980 | return true;
|
---|
2981 | } else {
|
---|
2982 | return (0, _shallowEqual.default)(node, opts);
|
---|
2983 | }
|
---|
2984 | }
|
---|
2985 |
|
---|
2986 | return false;
|
---|
2987 | }
|
---|
2988 |
|
---|
2989 | function isTopicReference(node, opts) {
|
---|
2990 | if (!node) return false;
|
---|
2991 | const nodeType = node.type;
|
---|
2992 |
|
---|
2993 | if (nodeType === "TopicReference") {
|
---|
2994 | if (typeof opts === "undefined") {
|
---|
2995 | return true;
|
---|
2996 | } else {
|
---|
2997 | return (0, _shallowEqual.default)(node, opts);
|
---|
2998 | }
|
---|
2999 | }
|
---|
3000 |
|
---|
3001 | return false;
|
---|
3002 | }
|
---|
3003 |
|
---|
3004 | function isPipelineTopicExpression(node, opts) {
|
---|
3005 | if (!node) return false;
|
---|
3006 | const nodeType = node.type;
|
---|
3007 |
|
---|
3008 | if (nodeType === "PipelineTopicExpression") {
|
---|
3009 | if (typeof opts === "undefined") {
|
---|
3010 | return true;
|
---|
3011 | } else {
|
---|
3012 | return (0, _shallowEqual.default)(node, opts);
|
---|
3013 | }
|
---|
3014 | }
|
---|
3015 |
|
---|
3016 | return false;
|
---|
3017 | }
|
---|
3018 |
|
---|
3019 | function isPipelineBareFunction(node, opts) {
|
---|
3020 | if (!node) return false;
|
---|
3021 | const nodeType = node.type;
|
---|
3022 |
|
---|
3023 | if (nodeType === "PipelineBareFunction") {
|
---|
3024 | if (typeof opts === "undefined") {
|
---|
3025 | return true;
|
---|
3026 | } else {
|
---|
3027 | return (0, _shallowEqual.default)(node, opts);
|
---|
3028 | }
|
---|
3029 | }
|
---|
3030 |
|
---|
3031 | return false;
|
---|
3032 | }
|
---|
3033 |
|
---|
3034 | function isPipelinePrimaryTopicReference(node, opts) {
|
---|
3035 | if (!node) return false;
|
---|
3036 | const nodeType = node.type;
|
---|
3037 |
|
---|
3038 | if (nodeType === "PipelinePrimaryTopicReference") {
|
---|
3039 | if (typeof opts === "undefined") {
|
---|
3040 | return true;
|
---|
3041 | } else {
|
---|
3042 | return (0, _shallowEqual.default)(node, opts);
|
---|
3043 | }
|
---|
3044 | }
|
---|
3045 |
|
---|
3046 | return false;
|
---|
3047 | }
|
---|
3048 |
|
---|
3049 | function isTSParameterProperty(node, opts) {
|
---|
3050 | if (!node) return false;
|
---|
3051 | const nodeType = node.type;
|
---|
3052 |
|
---|
3053 | if (nodeType === "TSParameterProperty") {
|
---|
3054 | if (typeof opts === "undefined") {
|
---|
3055 | return true;
|
---|
3056 | } else {
|
---|
3057 | return (0, _shallowEqual.default)(node, opts);
|
---|
3058 | }
|
---|
3059 | }
|
---|
3060 |
|
---|
3061 | return false;
|
---|
3062 | }
|
---|
3063 |
|
---|
3064 | function isTSDeclareFunction(node, opts) {
|
---|
3065 | if (!node) return false;
|
---|
3066 | const nodeType = node.type;
|
---|
3067 |
|
---|
3068 | if (nodeType === "TSDeclareFunction") {
|
---|
3069 | if (typeof opts === "undefined") {
|
---|
3070 | return true;
|
---|
3071 | } else {
|
---|
3072 | return (0, _shallowEqual.default)(node, opts);
|
---|
3073 | }
|
---|
3074 | }
|
---|
3075 |
|
---|
3076 | return false;
|
---|
3077 | }
|
---|
3078 |
|
---|
3079 | function isTSDeclareMethod(node, opts) {
|
---|
3080 | if (!node) return false;
|
---|
3081 | const nodeType = node.type;
|
---|
3082 |
|
---|
3083 | if (nodeType === "TSDeclareMethod") {
|
---|
3084 | if (typeof opts === "undefined") {
|
---|
3085 | return true;
|
---|
3086 | } else {
|
---|
3087 | return (0, _shallowEqual.default)(node, opts);
|
---|
3088 | }
|
---|
3089 | }
|
---|
3090 |
|
---|
3091 | return false;
|
---|
3092 | }
|
---|
3093 |
|
---|
3094 | function isTSQualifiedName(node, opts) {
|
---|
3095 | if (!node) return false;
|
---|
3096 | const nodeType = node.type;
|
---|
3097 |
|
---|
3098 | if (nodeType === "TSQualifiedName") {
|
---|
3099 | if (typeof opts === "undefined") {
|
---|
3100 | return true;
|
---|
3101 | } else {
|
---|
3102 | return (0, _shallowEqual.default)(node, opts);
|
---|
3103 | }
|
---|
3104 | }
|
---|
3105 |
|
---|
3106 | return false;
|
---|
3107 | }
|
---|
3108 |
|
---|
3109 | function isTSCallSignatureDeclaration(node, opts) {
|
---|
3110 | if (!node) return false;
|
---|
3111 | const nodeType = node.type;
|
---|
3112 |
|
---|
3113 | if (nodeType === "TSCallSignatureDeclaration") {
|
---|
3114 | if (typeof opts === "undefined") {
|
---|
3115 | return true;
|
---|
3116 | } else {
|
---|
3117 | return (0, _shallowEqual.default)(node, opts);
|
---|
3118 | }
|
---|
3119 | }
|
---|
3120 |
|
---|
3121 | return false;
|
---|
3122 | }
|
---|
3123 |
|
---|
3124 | function isTSConstructSignatureDeclaration(node, opts) {
|
---|
3125 | if (!node) return false;
|
---|
3126 | const nodeType = node.type;
|
---|
3127 |
|
---|
3128 | if (nodeType === "TSConstructSignatureDeclaration") {
|
---|
3129 | if (typeof opts === "undefined") {
|
---|
3130 | return true;
|
---|
3131 | } else {
|
---|
3132 | return (0, _shallowEqual.default)(node, opts);
|
---|
3133 | }
|
---|
3134 | }
|
---|
3135 |
|
---|
3136 | return false;
|
---|
3137 | }
|
---|
3138 |
|
---|
3139 | function isTSPropertySignature(node, opts) {
|
---|
3140 | if (!node) return false;
|
---|
3141 | const nodeType = node.type;
|
---|
3142 |
|
---|
3143 | if (nodeType === "TSPropertySignature") {
|
---|
3144 | if (typeof opts === "undefined") {
|
---|
3145 | return true;
|
---|
3146 | } else {
|
---|
3147 | return (0, _shallowEqual.default)(node, opts);
|
---|
3148 | }
|
---|
3149 | }
|
---|
3150 |
|
---|
3151 | return false;
|
---|
3152 | }
|
---|
3153 |
|
---|
3154 | function isTSMethodSignature(node, opts) {
|
---|
3155 | if (!node) return false;
|
---|
3156 | const nodeType = node.type;
|
---|
3157 |
|
---|
3158 | if (nodeType === "TSMethodSignature") {
|
---|
3159 | if (typeof opts === "undefined") {
|
---|
3160 | return true;
|
---|
3161 | } else {
|
---|
3162 | return (0, _shallowEqual.default)(node, opts);
|
---|
3163 | }
|
---|
3164 | }
|
---|
3165 |
|
---|
3166 | return false;
|
---|
3167 | }
|
---|
3168 |
|
---|
3169 | function isTSIndexSignature(node, opts) {
|
---|
3170 | if (!node) return false;
|
---|
3171 | const nodeType = node.type;
|
---|
3172 |
|
---|
3173 | if (nodeType === "TSIndexSignature") {
|
---|
3174 | if (typeof opts === "undefined") {
|
---|
3175 | return true;
|
---|
3176 | } else {
|
---|
3177 | return (0, _shallowEqual.default)(node, opts);
|
---|
3178 | }
|
---|
3179 | }
|
---|
3180 |
|
---|
3181 | return false;
|
---|
3182 | }
|
---|
3183 |
|
---|
3184 | function isTSAnyKeyword(node, opts) {
|
---|
3185 | if (!node) return false;
|
---|
3186 | const nodeType = node.type;
|
---|
3187 |
|
---|
3188 | if (nodeType === "TSAnyKeyword") {
|
---|
3189 | if (typeof opts === "undefined") {
|
---|
3190 | return true;
|
---|
3191 | } else {
|
---|
3192 | return (0, _shallowEqual.default)(node, opts);
|
---|
3193 | }
|
---|
3194 | }
|
---|
3195 |
|
---|
3196 | return false;
|
---|
3197 | }
|
---|
3198 |
|
---|
3199 | function isTSBooleanKeyword(node, opts) {
|
---|
3200 | if (!node) return false;
|
---|
3201 | const nodeType = node.type;
|
---|
3202 |
|
---|
3203 | if (nodeType === "TSBooleanKeyword") {
|
---|
3204 | if (typeof opts === "undefined") {
|
---|
3205 | return true;
|
---|
3206 | } else {
|
---|
3207 | return (0, _shallowEqual.default)(node, opts);
|
---|
3208 | }
|
---|
3209 | }
|
---|
3210 |
|
---|
3211 | return false;
|
---|
3212 | }
|
---|
3213 |
|
---|
3214 | function isTSBigIntKeyword(node, opts) {
|
---|
3215 | if (!node) return false;
|
---|
3216 | const nodeType = node.type;
|
---|
3217 |
|
---|
3218 | if (nodeType === "TSBigIntKeyword") {
|
---|
3219 | if (typeof opts === "undefined") {
|
---|
3220 | return true;
|
---|
3221 | } else {
|
---|
3222 | return (0, _shallowEqual.default)(node, opts);
|
---|
3223 | }
|
---|
3224 | }
|
---|
3225 |
|
---|
3226 | return false;
|
---|
3227 | }
|
---|
3228 |
|
---|
3229 | function isTSIntrinsicKeyword(node, opts) {
|
---|
3230 | if (!node) return false;
|
---|
3231 | const nodeType = node.type;
|
---|
3232 |
|
---|
3233 | if (nodeType === "TSIntrinsicKeyword") {
|
---|
3234 | if (typeof opts === "undefined") {
|
---|
3235 | return true;
|
---|
3236 | } else {
|
---|
3237 | return (0, _shallowEqual.default)(node, opts);
|
---|
3238 | }
|
---|
3239 | }
|
---|
3240 |
|
---|
3241 | return false;
|
---|
3242 | }
|
---|
3243 |
|
---|
3244 | function isTSNeverKeyword(node, opts) {
|
---|
3245 | if (!node) return false;
|
---|
3246 | const nodeType = node.type;
|
---|
3247 |
|
---|
3248 | if (nodeType === "TSNeverKeyword") {
|
---|
3249 | if (typeof opts === "undefined") {
|
---|
3250 | return true;
|
---|
3251 | } else {
|
---|
3252 | return (0, _shallowEqual.default)(node, opts);
|
---|
3253 | }
|
---|
3254 | }
|
---|
3255 |
|
---|
3256 | return false;
|
---|
3257 | }
|
---|
3258 |
|
---|
3259 | function isTSNullKeyword(node, opts) {
|
---|
3260 | if (!node) return false;
|
---|
3261 | const nodeType = node.type;
|
---|
3262 |
|
---|
3263 | if (nodeType === "TSNullKeyword") {
|
---|
3264 | if (typeof opts === "undefined") {
|
---|
3265 | return true;
|
---|
3266 | } else {
|
---|
3267 | return (0, _shallowEqual.default)(node, opts);
|
---|
3268 | }
|
---|
3269 | }
|
---|
3270 |
|
---|
3271 | return false;
|
---|
3272 | }
|
---|
3273 |
|
---|
3274 | function isTSNumberKeyword(node, opts) {
|
---|
3275 | if (!node) return false;
|
---|
3276 | const nodeType = node.type;
|
---|
3277 |
|
---|
3278 | if (nodeType === "TSNumberKeyword") {
|
---|
3279 | if (typeof opts === "undefined") {
|
---|
3280 | return true;
|
---|
3281 | } else {
|
---|
3282 | return (0, _shallowEqual.default)(node, opts);
|
---|
3283 | }
|
---|
3284 | }
|
---|
3285 |
|
---|
3286 | return false;
|
---|
3287 | }
|
---|
3288 |
|
---|
3289 | function isTSObjectKeyword(node, opts) {
|
---|
3290 | if (!node) return false;
|
---|
3291 | const nodeType = node.type;
|
---|
3292 |
|
---|
3293 | if (nodeType === "TSObjectKeyword") {
|
---|
3294 | if (typeof opts === "undefined") {
|
---|
3295 | return true;
|
---|
3296 | } else {
|
---|
3297 | return (0, _shallowEqual.default)(node, opts);
|
---|
3298 | }
|
---|
3299 | }
|
---|
3300 |
|
---|
3301 | return false;
|
---|
3302 | }
|
---|
3303 |
|
---|
3304 | function isTSStringKeyword(node, opts) {
|
---|
3305 | if (!node) return false;
|
---|
3306 | const nodeType = node.type;
|
---|
3307 |
|
---|
3308 | if (nodeType === "TSStringKeyword") {
|
---|
3309 | if (typeof opts === "undefined") {
|
---|
3310 | return true;
|
---|
3311 | } else {
|
---|
3312 | return (0, _shallowEqual.default)(node, opts);
|
---|
3313 | }
|
---|
3314 | }
|
---|
3315 |
|
---|
3316 | return false;
|
---|
3317 | }
|
---|
3318 |
|
---|
3319 | function isTSSymbolKeyword(node, opts) {
|
---|
3320 | if (!node) return false;
|
---|
3321 | const nodeType = node.type;
|
---|
3322 |
|
---|
3323 | if (nodeType === "TSSymbolKeyword") {
|
---|
3324 | if (typeof opts === "undefined") {
|
---|
3325 | return true;
|
---|
3326 | } else {
|
---|
3327 | return (0, _shallowEqual.default)(node, opts);
|
---|
3328 | }
|
---|
3329 | }
|
---|
3330 |
|
---|
3331 | return false;
|
---|
3332 | }
|
---|
3333 |
|
---|
3334 | function isTSUndefinedKeyword(node, opts) {
|
---|
3335 | if (!node) return false;
|
---|
3336 | const nodeType = node.type;
|
---|
3337 |
|
---|
3338 | if (nodeType === "TSUndefinedKeyword") {
|
---|
3339 | if (typeof opts === "undefined") {
|
---|
3340 | return true;
|
---|
3341 | } else {
|
---|
3342 | return (0, _shallowEqual.default)(node, opts);
|
---|
3343 | }
|
---|
3344 | }
|
---|
3345 |
|
---|
3346 | return false;
|
---|
3347 | }
|
---|
3348 |
|
---|
3349 | function isTSUnknownKeyword(node, opts) {
|
---|
3350 | if (!node) return false;
|
---|
3351 | const nodeType = node.type;
|
---|
3352 |
|
---|
3353 | if (nodeType === "TSUnknownKeyword") {
|
---|
3354 | if (typeof opts === "undefined") {
|
---|
3355 | return true;
|
---|
3356 | } else {
|
---|
3357 | return (0, _shallowEqual.default)(node, opts);
|
---|
3358 | }
|
---|
3359 | }
|
---|
3360 |
|
---|
3361 | return false;
|
---|
3362 | }
|
---|
3363 |
|
---|
3364 | function isTSVoidKeyword(node, opts) {
|
---|
3365 | if (!node) return false;
|
---|
3366 | const nodeType = node.type;
|
---|
3367 |
|
---|
3368 | if (nodeType === "TSVoidKeyword") {
|
---|
3369 | if (typeof opts === "undefined") {
|
---|
3370 | return true;
|
---|
3371 | } else {
|
---|
3372 | return (0, _shallowEqual.default)(node, opts);
|
---|
3373 | }
|
---|
3374 | }
|
---|
3375 |
|
---|
3376 | return false;
|
---|
3377 | }
|
---|
3378 |
|
---|
3379 | function isTSThisType(node, opts) {
|
---|
3380 | if (!node) return false;
|
---|
3381 | const nodeType = node.type;
|
---|
3382 |
|
---|
3383 | if (nodeType === "TSThisType") {
|
---|
3384 | if (typeof opts === "undefined") {
|
---|
3385 | return true;
|
---|
3386 | } else {
|
---|
3387 | return (0, _shallowEqual.default)(node, opts);
|
---|
3388 | }
|
---|
3389 | }
|
---|
3390 |
|
---|
3391 | return false;
|
---|
3392 | }
|
---|
3393 |
|
---|
3394 | function isTSFunctionType(node, opts) {
|
---|
3395 | if (!node) return false;
|
---|
3396 | const nodeType = node.type;
|
---|
3397 |
|
---|
3398 | if (nodeType === "TSFunctionType") {
|
---|
3399 | if (typeof opts === "undefined") {
|
---|
3400 | return true;
|
---|
3401 | } else {
|
---|
3402 | return (0, _shallowEqual.default)(node, opts);
|
---|
3403 | }
|
---|
3404 | }
|
---|
3405 |
|
---|
3406 | return false;
|
---|
3407 | }
|
---|
3408 |
|
---|
3409 | function isTSConstructorType(node, opts) {
|
---|
3410 | if (!node) return false;
|
---|
3411 | const nodeType = node.type;
|
---|
3412 |
|
---|
3413 | if (nodeType === "TSConstructorType") {
|
---|
3414 | if (typeof opts === "undefined") {
|
---|
3415 | return true;
|
---|
3416 | } else {
|
---|
3417 | return (0, _shallowEqual.default)(node, opts);
|
---|
3418 | }
|
---|
3419 | }
|
---|
3420 |
|
---|
3421 | return false;
|
---|
3422 | }
|
---|
3423 |
|
---|
3424 | function isTSTypeReference(node, opts) {
|
---|
3425 | if (!node) return false;
|
---|
3426 | const nodeType = node.type;
|
---|
3427 |
|
---|
3428 | if (nodeType === "TSTypeReference") {
|
---|
3429 | if (typeof opts === "undefined") {
|
---|
3430 | return true;
|
---|
3431 | } else {
|
---|
3432 | return (0, _shallowEqual.default)(node, opts);
|
---|
3433 | }
|
---|
3434 | }
|
---|
3435 |
|
---|
3436 | return false;
|
---|
3437 | }
|
---|
3438 |
|
---|
3439 | function isTSTypePredicate(node, opts) {
|
---|
3440 | if (!node) return false;
|
---|
3441 | const nodeType = node.type;
|
---|
3442 |
|
---|
3443 | if (nodeType === "TSTypePredicate") {
|
---|
3444 | if (typeof opts === "undefined") {
|
---|
3445 | return true;
|
---|
3446 | } else {
|
---|
3447 | return (0, _shallowEqual.default)(node, opts);
|
---|
3448 | }
|
---|
3449 | }
|
---|
3450 |
|
---|
3451 | return false;
|
---|
3452 | }
|
---|
3453 |
|
---|
3454 | function isTSTypeQuery(node, opts) {
|
---|
3455 | if (!node) return false;
|
---|
3456 | const nodeType = node.type;
|
---|
3457 |
|
---|
3458 | if (nodeType === "TSTypeQuery") {
|
---|
3459 | if (typeof opts === "undefined") {
|
---|
3460 | return true;
|
---|
3461 | } else {
|
---|
3462 | return (0, _shallowEqual.default)(node, opts);
|
---|
3463 | }
|
---|
3464 | }
|
---|
3465 |
|
---|
3466 | return false;
|
---|
3467 | }
|
---|
3468 |
|
---|
3469 | function isTSTypeLiteral(node, opts) {
|
---|
3470 | if (!node) return false;
|
---|
3471 | const nodeType = node.type;
|
---|
3472 |
|
---|
3473 | if (nodeType === "TSTypeLiteral") {
|
---|
3474 | if (typeof opts === "undefined") {
|
---|
3475 | return true;
|
---|
3476 | } else {
|
---|
3477 | return (0, _shallowEqual.default)(node, opts);
|
---|
3478 | }
|
---|
3479 | }
|
---|
3480 |
|
---|
3481 | return false;
|
---|
3482 | }
|
---|
3483 |
|
---|
3484 | function isTSArrayType(node, opts) {
|
---|
3485 | if (!node) return false;
|
---|
3486 | const nodeType = node.type;
|
---|
3487 |
|
---|
3488 | if (nodeType === "TSArrayType") {
|
---|
3489 | if (typeof opts === "undefined") {
|
---|
3490 | return true;
|
---|
3491 | } else {
|
---|
3492 | return (0, _shallowEqual.default)(node, opts);
|
---|
3493 | }
|
---|
3494 | }
|
---|
3495 |
|
---|
3496 | return false;
|
---|
3497 | }
|
---|
3498 |
|
---|
3499 | function isTSTupleType(node, opts) {
|
---|
3500 | if (!node) return false;
|
---|
3501 | const nodeType = node.type;
|
---|
3502 |
|
---|
3503 | if (nodeType === "TSTupleType") {
|
---|
3504 | if (typeof opts === "undefined") {
|
---|
3505 | return true;
|
---|
3506 | } else {
|
---|
3507 | return (0, _shallowEqual.default)(node, opts);
|
---|
3508 | }
|
---|
3509 | }
|
---|
3510 |
|
---|
3511 | return false;
|
---|
3512 | }
|
---|
3513 |
|
---|
3514 | function isTSOptionalType(node, opts) {
|
---|
3515 | if (!node) return false;
|
---|
3516 | const nodeType = node.type;
|
---|
3517 |
|
---|
3518 | if (nodeType === "TSOptionalType") {
|
---|
3519 | if (typeof opts === "undefined") {
|
---|
3520 | return true;
|
---|
3521 | } else {
|
---|
3522 | return (0, _shallowEqual.default)(node, opts);
|
---|
3523 | }
|
---|
3524 | }
|
---|
3525 |
|
---|
3526 | return false;
|
---|
3527 | }
|
---|
3528 |
|
---|
3529 | function isTSRestType(node, opts) {
|
---|
3530 | if (!node) return false;
|
---|
3531 | const nodeType = node.type;
|
---|
3532 |
|
---|
3533 | if (nodeType === "TSRestType") {
|
---|
3534 | if (typeof opts === "undefined") {
|
---|
3535 | return true;
|
---|
3536 | } else {
|
---|
3537 | return (0, _shallowEqual.default)(node, opts);
|
---|
3538 | }
|
---|
3539 | }
|
---|
3540 |
|
---|
3541 | return false;
|
---|
3542 | }
|
---|
3543 |
|
---|
3544 | function isTSNamedTupleMember(node, opts) {
|
---|
3545 | if (!node) return false;
|
---|
3546 | const nodeType = node.type;
|
---|
3547 |
|
---|
3548 | if (nodeType === "TSNamedTupleMember") {
|
---|
3549 | if (typeof opts === "undefined") {
|
---|
3550 | return true;
|
---|
3551 | } else {
|
---|
3552 | return (0, _shallowEqual.default)(node, opts);
|
---|
3553 | }
|
---|
3554 | }
|
---|
3555 |
|
---|
3556 | return false;
|
---|
3557 | }
|
---|
3558 |
|
---|
3559 | function isTSUnionType(node, opts) {
|
---|
3560 | if (!node) return false;
|
---|
3561 | const nodeType = node.type;
|
---|
3562 |
|
---|
3563 | if (nodeType === "TSUnionType") {
|
---|
3564 | if (typeof opts === "undefined") {
|
---|
3565 | return true;
|
---|
3566 | } else {
|
---|
3567 | return (0, _shallowEqual.default)(node, opts);
|
---|
3568 | }
|
---|
3569 | }
|
---|
3570 |
|
---|
3571 | return false;
|
---|
3572 | }
|
---|
3573 |
|
---|
3574 | function isTSIntersectionType(node, opts) {
|
---|
3575 | if (!node) return false;
|
---|
3576 | const nodeType = node.type;
|
---|
3577 |
|
---|
3578 | if (nodeType === "TSIntersectionType") {
|
---|
3579 | if (typeof opts === "undefined") {
|
---|
3580 | return true;
|
---|
3581 | } else {
|
---|
3582 | return (0, _shallowEqual.default)(node, opts);
|
---|
3583 | }
|
---|
3584 | }
|
---|
3585 |
|
---|
3586 | return false;
|
---|
3587 | }
|
---|
3588 |
|
---|
3589 | function isTSConditionalType(node, opts) {
|
---|
3590 | if (!node) return false;
|
---|
3591 | const nodeType = node.type;
|
---|
3592 |
|
---|
3593 | if (nodeType === "TSConditionalType") {
|
---|
3594 | if (typeof opts === "undefined") {
|
---|
3595 | return true;
|
---|
3596 | } else {
|
---|
3597 | return (0, _shallowEqual.default)(node, opts);
|
---|
3598 | }
|
---|
3599 | }
|
---|
3600 |
|
---|
3601 | return false;
|
---|
3602 | }
|
---|
3603 |
|
---|
3604 | function isTSInferType(node, opts) {
|
---|
3605 | if (!node) return false;
|
---|
3606 | const nodeType = node.type;
|
---|
3607 |
|
---|
3608 | if (nodeType === "TSInferType") {
|
---|
3609 | if (typeof opts === "undefined") {
|
---|
3610 | return true;
|
---|
3611 | } else {
|
---|
3612 | return (0, _shallowEqual.default)(node, opts);
|
---|
3613 | }
|
---|
3614 | }
|
---|
3615 |
|
---|
3616 | return false;
|
---|
3617 | }
|
---|
3618 |
|
---|
3619 | function isTSParenthesizedType(node, opts) {
|
---|
3620 | if (!node) return false;
|
---|
3621 | const nodeType = node.type;
|
---|
3622 |
|
---|
3623 | if (nodeType === "TSParenthesizedType") {
|
---|
3624 | if (typeof opts === "undefined") {
|
---|
3625 | return true;
|
---|
3626 | } else {
|
---|
3627 | return (0, _shallowEqual.default)(node, opts);
|
---|
3628 | }
|
---|
3629 | }
|
---|
3630 |
|
---|
3631 | return false;
|
---|
3632 | }
|
---|
3633 |
|
---|
3634 | function isTSTypeOperator(node, opts) {
|
---|
3635 | if (!node) return false;
|
---|
3636 | const nodeType = node.type;
|
---|
3637 |
|
---|
3638 | if (nodeType === "TSTypeOperator") {
|
---|
3639 | if (typeof opts === "undefined") {
|
---|
3640 | return true;
|
---|
3641 | } else {
|
---|
3642 | return (0, _shallowEqual.default)(node, opts);
|
---|
3643 | }
|
---|
3644 | }
|
---|
3645 |
|
---|
3646 | return false;
|
---|
3647 | }
|
---|
3648 |
|
---|
3649 | function isTSIndexedAccessType(node, opts) {
|
---|
3650 | if (!node) return false;
|
---|
3651 | const nodeType = node.type;
|
---|
3652 |
|
---|
3653 | if (nodeType === "TSIndexedAccessType") {
|
---|
3654 | if (typeof opts === "undefined") {
|
---|
3655 | return true;
|
---|
3656 | } else {
|
---|
3657 | return (0, _shallowEqual.default)(node, opts);
|
---|
3658 | }
|
---|
3659 | }
|
---|
3660 |
|
---|
3661 | return false;
|
---|
3662 | }
|
---|
3663 |
|
---|
3664 | function isTSMappedType(node, opts) {
|
---|
3665 | if (!node) return false;
|
---|
3666 | const nodeType = node.type;
|
---|
3667 |
|
---|
3668 | if (nodeType === "TSMappedType") {
|
---|
3669 | if (typeof opts === "undefined") {
|
---|
3670 | return true;
|
---|
3671 | } else {
|
---|
3672 | return (0, _shallowEqual.default)(node, opts);
|
---|
3673 | }
|
---|
3674 | }
|
---|
3675 |
|
---|
3676 | return false;
|
---|
3677 | }
|
---|
3678 |
|
---|
3679 | function isTSLiteralType(node, opts) {
|
---|
3680 | if (!node) return false;
|
---|
3681 | const nodeType = node.type;
|
---|
3682 |
|
---|
3683 | if (nodeType === "TSLiteralType") {
|
---|
3684 | if (typeof opts === "undefined") {
|
---|
3685 | return true;
|
---|
3686 | } else {
|
---|
3687 | return (0, _shallowEqual.default)(node, opts);
|
---|
3688 | }
|
---|
3689 | }
|
---|
3690 |
|
---|
3691 | return false;
|
---|
3692 | }
|
---|
3693 |
|
---|
3694 | function isTSExpressionWithTypeArguments(node, opts) {
|
---|
3695 | if (!node) return false;
|
---|
3696 | const nodeType = node.type;
|
---|
3697 |
|
---|
3698 | if (nodeType === "TSExpressionWithTypeArguments") {
|
---|
3699 | if (typeof opts === "undefined") {
|
---|
3700 | return true;
|
---|
3701 | } else {
|
---|
3702 | return (0, _shallowEqual.default)(node, opts);
|
---|
3703 | }
|
---|
3704 | }
|
---|
3705 |
|
---|
3706 | return false;
|
---|
3707 | }
|
---|
3708 |
|
---|
3709 | function isTSInterfaceDeclaration(node, opts) {
|
---|
3710 | if (!node) return false;
|
---|
3711 | const nodeType = node.type;
|
---|
3712 |
|
---|
3713 | if (nodeType === "TSInterfaceDeclaration") {
|
---|
3714 | if (typeof opts === "undefined") {
|
---|
3715 | return true;
|
---|
3716 | } else {
|
---|
3717 | return (0, _shallowEqual.default)(node, opts);
|
---|
3718 | }
|
---|
3719 | }
|
---|
3720 |
|
---|
3721 | return false;
|
---|
3722 | }
|
---|
3723 |
|
---|
3724 | function isTSInterfaceBody(node, opts) {
|
---|
3725 | if (!node) return false;
|
---|
3726 | const nodeType = node.type;
|
---|
3727 |
|
---|
3728 | if (nodeType === "TSInterfaceBody") {
|
---|
3729 | if (typeof opts === "undefined") {
|
---|
3730 | return true;
|
---|
3731 | } else {
|
---|
3732 | return (0, _shallowEqual.default)(node, opts);
|
---|
3733 | }
|
---|
3734 | }
|
---|
3735 |
|
---|
3736 | return false;
|
---|
3737 | }
|
---|
3738 |
|
---|
3739 | function isTSTypeAliasDeclaration(node, opts) {
|
---|
3740 | if (!node) return false;
|
---|
3741 | const nodeType = node.type;
|
---|
3742 |
|
---|
3743 | if (nodeType === "TSTypeAliasDeclaration") {
|
---|
3744 | if (typeof opts === "undefined") {
|
---|
3745 | return true;
|
---|
3746 | } else {
|
---|
3747 | return (0, _shallowEqual.default)(node, opts);
|
---|
3748 | }
|
---|
3749 | }
|
---|
3750 |
|
---|
3751 | return false;
|
---|
3752 | }
|
---|
3753 |
|
---|
3754 | function isTSAsExpression(node, opts) {
|
---|
3755 | if (!node) return false;
|
---|
3756 | const nodeType = node.type;
|
---|
3757 |
|
---|
3758 | if (nodeType === "TSAsExpression") {
|
---|
3759 | if (typeof opts === "undefined") {
|
---|
3760 | return true;
|
---|
3761 | } else {
|
---|
3762 | return (0, _shallowEqual.default)(node, opts);
|
---|
3763 | }
|
---|
3764 | }
|
---|
3765 |
|
---|
3766 | return false;
|
---|
3767 | }
|
---|
3768 |
|
---|
3769 | function isTSTypeAssertion(node, opts) {
|
---|
3770 | if (!node) return false;
|
---|
3771 | const nodeType = node.type;
|
---|
3772 |
|
---|
3773 | if (nodeType === "TSTypeAssertion") {
|
---|
3774 | if (typeof opts === "undefined") {
|
---|
3775 | return true;
|
---|
3776 | } else {
|
---|
3777 | return (0, _shallowEqual.default)(node, opts);
|
---|
3778 | }
|
---|
3779 | }
|
---|
3780 |
|
---|
3781 | return false;
|
---|
3782 | }
|
---|
3783 |
|
---|
3784 | function isTSEnumDeclaration(node, opts) {
|
---|
3785 | if (!node) return false;
|
---|
3786 | const nodeType = node.type;
|
---|
3787 |
|
---|
3788 | if (nodeType === "TSEnumDeclaration") {
|
---|
3789 | if (typeof opts === "undefined") {
|
---|
3790 | return true;
|
---|
3791 | } else {
|
---|
3792 | return (0, _shallowEqual.default)(node, opts);
|
---|
3793 | }
|
---|
3794 | }
|
---|
3795 |
|
---|
3796 | return false;
|
---|
3797 | }
|
---|
3798 |
|
---|
3799 | function isTSEnumMember(node, opts) {
|
---|
3800 | if (!node) return false;
|
---|
3801 | const nodeType = node.type;
|
---|
3802 |
|
---|
3803 | if (nodeType === "TSEnumMember") {
|
---|
3804 | if (typeof opts === "undefined") {
|
---|
3805 | return true;
|
---|
3806 | } else {
|
---|
3807 | return (0, _shallowEqual.default)(node, opts);
|
---|
3808 | }
|
---|
3809 | }
|
---|
3810 |
|
---|
3811 | return false;
|
---|
3812 | }
|
---|
3813 |
|
---|
3814 | function isTSModuleDeclaration(node, opts) {
|
---|
3815 | if (!node) return false;
|
---|
3816 | const nodeType = node.type;
|
---|
3817 |
|
---|
3818 | if (nodeType === "TSModuleDeclaration") {
|
---|
3819 | if (typeof opts === "undefined") {
|
---|
3820 | return true;
|
---|
3821 | } else {
|
---|
3822 | return (0, _shallowEqual.default)(node, opts);
|
---|
3823 | }
|
---|
3824 | }
|
---|
3825 |
|
---|
3826 | return false;
|
---|
3827 | }
|
---|
3828 |
|
---|
3829 | function isTSModuleBlock(node, opts) {
|
---|
3830 | if (!node) return false;
|
---|
3831 | const nodeType = node.type;
|
---|
3832 |
|
---|
3833 | if (nodeType === "TSModuleBlock") {
|
---|
3834 | if (typeof opts === "undefined") {
|
---|
3835 | return true;
|
---|
3836 | } else {
|
---|
3837 | return (0, _shallowEqual.default)(node, opts);
|
---|
3838 | }
|
---|
3839 | }
|
---|
3840 |
|
---|
3841 | return false;
|
---|
3842 | }
|
---|
3843 |
|
---|
3844 | function isTSImportType(node, opts) {
|
---|
3845 | if (!node) return false;
|
---|
3846 | const nodeType = node.type;
|
---|
3847 |
|
---|
3848 | if (nodeType === "TSImportType") {
|
---|
3849 | if (typeof opts === "undefined") {
|
---|
3850 | return true;
|
---|
3851 | } else {
|
---|
3852 | return (0, _shallowEqual.default)(node, opts);
|
---|
3853 | }
|
---|
3854 | }
|
---|
3855 |
|
---|
3856 | return false;
|
---|
3857 | }
|
---|
3858 |
|
---|
3859 | function isTSImportEqualsDeclaration(node, opts) {
|
---|
3860 | if (!node) return false;
|
---|
3861 | const nodeType = node.type;
|
---|
3862 |
|
---|
3863 | if (nodeType === "TSImportEqualsDeclaration") {
|
---|
3864 | if (typeof opts === "undefined") {
|
---|
3865 | return true;
|
---|
3866 | } else {
|
---|
3867 | return (0, _shallowEqual.default)(node, opts);
|
---|
3868 | }
|
---|
3869 | }
|
---|
3870 |
|
---|
3871 | return false;
|
---|
3872 | }
|
---|
3873 |
|
---|
3874 | function isTSExternalModuleReference(node, opts) {
|
---|
3875 | if (!node) return false;
|
---|
3876 | const nodeType = node.type;
|
---|
3877 |
|
---|
3878 | if (nodeType === "TSExternalModuleReference") {
|
---|
3879 | if (typeof opts === "undefined") {
|
---|
3880 | return true;
|
---|
3881 | } else {
|
---|
3882 | return (0, _shallowEqual.default)(node, opts);
|
---|
3883 | }
|
---|
3884 | }
|
---|
3885 |
|
---|
3886 | return false;
|
---|
3887 | }
|
---|
3888 |
|
---|
3889 | function isTSNonNullExpression(node, opts) {
|
---|
3890 | if (!node) return false;
|
---|
3891 | const nodeType = node.type;
|
---|
3892 |
|
---|
3893 | if (nodeType === "TSNonNullExpression") {
|
---|
3894 | if (typeof opts === "undefined") {
|
---|
3895 | return true;
|
---|
3896 | } else {
|
---|
3897 | return (0, _shallowEqual.default)(node, opts);
|
---|
3898 | }
|
---|
3899 | }
|
---|
3900 |
|
---|
3901 | return false;
|
---|
3902 | }
|
---|
3903 |
|
---|
3904 | function isTSExportAssignment(node, opts) {
|
---|
3905 | if (!node) return false;
|
---|
3906 | const nodeType = node.type;
|
---|
3907 |
|
---|
3908 | if (nodeType === "TSExportAssignment") {
|
---|
3909 | if (typeof opts === "undefined") {
|
---|
3910 | return true;
|
---|
3911 | } else {
|
---|
3912 | return (0, _shallowEqual.default)(node, opts);
|
---|
3913 | }
|
---|
3914 | }
|
---|
3915 |
|
---|
3916 | return false;
|
---|
3917 | }
|
---|
3918 |
|
---|
3919 | function isTSNamespaceExportDeclaration(node, opts) {
|
---|
3920 | if (!node) return false;
|
---|
3921 | const nodeType = node.type;
|
---|
3922 |
|
---|
3923 | if (nodeType === "TSNamespaceExportDeclaration") {
|
---|
3924 | if (typeof opts === "undefined") {
|
---|
3925 | return true;
|
---|
3926 | } else {
|
---|
3927 | return (0, _shallowEqual.default)(node, opts);
|
---|
3928 | }
|
---|
3929 | }
|
---|
3930 |
|
---|
3931 | return false;
|
---|
3932 | }
|
---|
3933 |
|
---|
3934 | function isTSTypeAnnotation(node, opts) {
|
---|
3935 | if (!node) return false;
|
---|
3936 | const nodeType = node.type;
|
---|
3937 |
|
---|
3938 | if (nodeType === "TSTypeAnnotation") {
|
---|
3939 | if (typeof opts === "undefined") {
|
---|
3940 | return true;
|
---|
3941 | } else {
|
---|
3942 | return (0, _shallowEqual.default)(node, opts);
|
---|
3943 | }
|
---|
3944 | }
|
---|
3945 |
|
---|
3946 | return false;
|
---|
3947 | }
|
---|
3948 |
|
---|
3949 | function isTSTypeParameterInstantiation(node, opts) {
|
---|
3950 | if (!node) return false;
|
---|
3951 | const nodeType = node.type;
|
---|
3952 |
|
---|
3953 | if (nodeType === "TSTypeParameterInstantiation") {
|
---|
3954 | if (typeof opts === "undefined") {
|
---|
3955 | return true;
|
---|
3956 | } else {
|
---|
3957 | return (0, _shallowEqual.default)(node, opts);
|
---|
3958 | }
|
---|
3959 | }
|
---|
3960 |
|
---|
3961 | return false;
|
---|
3962 | }
|
---|
3963 |
|
---|
3964 | function isTSTypeParameterDeclaration(node, opts) {
|
---|
3965 | if (!node) return false;
|
---|
3966 | const nodeType = node.type;
|
---|
3967 |
|
---|
3968 | if (nodeType === "TSTypeParameterDeclaration") {
|
---|
3969 | if (typeof opts === "undefined") {
|
---|
3970 | return true;
|
---|
3971 | } else {
|
---|
3972 | return (0, _shallowEqual.default)(node, opts);
|
---|
3973 | }
|
---|
3974 | }
|
---|
3975 |
|
---|
3976 | return false;
|
---|
3977 | }
|
---|
3978 |
|
---|
3979 | function isTSTypeParameter(node, opts) {
|
---|
3980 | if (!node) return false;
|
---|
3981 | const nodeType = node.type;
|
---|
3982 |
|
---|
3983 | if (nodeType === "TSTypeParameter") {
|
---|
3984 | if (typeof opts === "undefined") {
|
---|
3985 | return true;
|
---|
3986 | } else {
|
---|
3987 | return (0, _shallowEqual.default)(node, opts);
|
---|
3988 | }
|
---|
3989 | }
|
---|
3990 |
|
---|
3991 | return false;
|
---|
3992 | }
|
---|
3993 |
|
---|
3994 | function isExpression(node, opts) {
|
---|
3995 | if (!node) return false;
|
---|
3996 | const nodeType = node.type;
|
---|
3997 |
|
---|
3998 | if ("ArrayExpression" === nodeType || "AssignmentExpression" === nodeType || "BinaryExpression" === nodeType || "CallExpression" === nodeType || "ConditionalExpression" === nodeType || "FunctionExpression" === nodeType || "Identifier" === nodeType || "StringLiteral" === nodeType || "NumericLiteral" === nodeType || "NullLiteral" === nodeType || "BooleanLiteral" === nodeType || "RegExpLiteral" === nodeType || "LogicalExpression" === nodeType || "MemberExpression" === nodeType || "NewExpression" === nodeType || "ObjectExpression" === nodeType || "SequenceExpression" === nodeType || "ParenthesizedExpression" === nodeType || "ThisExpression" === nodeType || "UnaryExpression" === nodeType || "UpdateExpression" === nodeType || "ArrowFunctionExpression" === nodeType || "ClassExpression" === nodeType || "MetaProperty" === nodeType || "Super" === nodeType || "TaggedTemplateExpression" === nodeType || "TemplateLiteral" === nodeType || "YieldExpression" === nodeType || "AwaitExpression" === nodeType || "Import" === nodeType || "BigIntLiteral" === nodeType || "OptionalMemberExpression" === nodeType || "OptionalCallExpression" === nodeType || "TypeCastExpression" === nodeType || "JSXElement" === nodeType || "JSXFragment" === nodeType || "BindExpression" === nodeType || "DoExpression" === nodeType || "RecordExpression" === nodeType || "TupleExpression" === nodeType || "DecimalLiteral" === nodeType || "ModuleExpression" === nodeType || "TopicReference" === nodeType || "PipelineTopicExpression" === nodeType || "PipelineBareFunction" === nodeType || "PipelinePrimaryTopicReference" === nodeType || "TSAsExpression" === nodeType || "TSTypeAssertion" === nodeType || "TSNonNullExpression" === nodeType || nodeType === "Placeholder" && ("Expression" === node.expectedNode || "Identifier" === node.expectedNode || "StringLiteral" === node.expectedNode)) {
|
---|
3999 | if (typeof opts === "undefined") {
|
---|
4000 | return true;
|
---|
4001 | } else {
|
---|
4002 | return (0, _shallowEqual.default)(node, opts);
|
---|
4003 | }
|
---|
4004 | }
|
---|
4005 |
|
---|
4006 | return false;
|
---|
4007 | }
|
---|
4008 |
|
---|
4009 | function isBinary(node, opts) {
|
---|
4010 | if (!node) return false;
|
---|
4011 | const nodeType = node.type;
|
---|
4012 |
|
---|
4013 | if ("BinaryExpression" === nodeType || "LogicalExpression" === nodeType) {
|
---|
4014 | if (typeof opts === "undefined") {
|
---|
4015 | return true;
|
---|
4016 | } else {
|
---|
4017 | return (0, _shallowEqual.default)(node, opts);
|
---|
4018 | }
|
---|
4019 | }
|
---|
4020 |
|
---|
4021 | return false;
|
---|
4022 | }
|
---|
4023 |
|
---|
4024 | function isScopable(node, opts) {
|
---|
4025 | if (!node) return false;
|
---|
4026 | const nodeType = node.type;
|
---|
4027 |
|
---|
4028 | if ("BlockStatement" === nodeType || "CatchClause" === nodeType || "DoWhileStatement" === nodeType || "ForInStatement" === nodeType || "ForStatement" === nodeType || "FunctionDeclaration" === nodeType || "FunctionExpression" === nodeType || "Program" === nodeType || "ObjectMethod" === nodeType || "SwitchStatement" === nodeType || "WhileStatement" === nodeType || "ArrowFunctionExpression" === nodeType || "ClassExpression" === nodeType || "ClassDeclaration" === nodeType || "ForOfStatement" === nodeType || "ClassMethod" === nodeType || "ClassPrivateMethod" === nodeType || "StaticBlock" === nodeType || "TSModuleBlock" === nodeType || nodeType === "Placeholder" && "BlockStatement" === node.expectedNode) {
|
---|
4029 | if (typeof opts === "undefined") {
|
---|
4030 | return true;
|
---|
4031 | } else {
|
---|
4032 | return (0, _shallowEqual.default)(node, opts);
|
---|
4033 | }
|
---|
4034 | }
|
---|
4035 |
|
---|
4036 | return false;
|
---|
4037 | }
|
---|
4038 |
|
---|
4039 | function isBlockParent(node, opts) {
|
---|
4040 | if (!node) return false;
|
---|
4041 | const nodeType = node.type;
|
---|
4042 |
|
---|
4043 | if ("BlockStatement" === nodeType || "CatchClause" === nodeType || "DoWhileStatement" === nodeType || "ForInStatement" === nodeType || "ForStatement" === nodeType || "FunctionDeclaration" === nodeType || "FunctionExpression" === nodeType || "Program" === nodeType || "ObjectMethod" === nodeType || "SwitchStatement" === nodeType || "WhileStatement" === nodeType || "ArrowFunctionExpression" === nodeType || "ForOfStatement" === nodeType || "ClassMethod" === nodeType || "ClassPrivateMethod" === nodeType || "StaticBlock" === nodeType || "TSModuleBlock" === nodeType || nodeType === "Placeholder" && "BlockStatement" === node.expectedNode) {
|
---|
4044 | if (typeof opts === "undefined") {
|
---|
4045 | return true;
|
---|
4046 | } else {
|
---|
4047 | return (0, _shallowEqual.default)(node, opts);
|
---|
4048 | }
|
---|
4049 | }
|
---|
4050 |
|
---|
4051 | return false;
|
---|
4052 | }
|
---|
4053 |
|
---|
4054 | function isBlock(node, opts) {
|
---|
4055 | if (!node) return false;
|
---|
4056 | const nodeType = node.type;
|
---|
4057 |
|
---|
4058 | if ("BlockStatement" === nodeType || "Program" === nodeType || "TSModuleBlock" === nodeType || nodeType === "Placeholder" && "BlockStatement" === node.expectedNode) {
|
---|
4059 | if (typeof opts === "undefined") {
|
---|
4060 | return true;
|
---|
4061 | } else {
|
---|
4062 | return (0, _shallowEqual.default)(node, opts);
|
---|
4063 | }
|
---|
4064 | }
|
---|
4065 |
|
---|
4066 | return false;
|
---|
4067 | }
|
---|
4068 |
|
---|
4069 | function isStatement(node, opts) {
|
---|
4070 | if (!node) return false;
|
---|
4071 | const nodeType = node.type;
|
---|
4072 |
|
---|
4073 | if ("BlockStatement" === nodeType || "BreakStatement" === nodeType || "ContinueStatement" === nodeType || "DebuggerStatement" === nodeType || "DoWhileStatement" === nodeType || "EmptyStatement" === nodeType || "ExpressionStatement" === nodeType || "ForInStatement" === nodeType || "ForStatement" === nodeType || "FunctionDeclaration" === nodeType || "IfStatement" === nodeType || "LabeledStatement" === nodeType || "ReturnStatement" === nodeType || "SwitchStatement" === nodeType || "ThrowStatement" === nodeType || "TryStatement" === nodeType || "VariableDeclaration" === nodeType || "WhileStatement" === nodeType || "WithStatement" === nodeType || "ClassDeclaration" === nodeType || "ExportAllDeclaration" === nodeType || "ExportDefaultDeclaration" === nodeType || "ExportNamedDeclaration" === nodeType || "ForOfStatement" === nodeType || "ImportDeclaration" === nodeType || "DeclareClass" === nodeType || "DeclareFunction" === nodeType || "DeclareInterface" === nodeType || "DeclareModule" === nodeType || "DeclareModuleExports" === nodeType || "DeclareTypeAlias" === nodeType || "DeclareOpaqueType" === nodeType || "DeclareVariable" === nodeType || "DeclareExportDeclaration" === nodeType || "DeclareExportAllDeclaration" === nodeType || "InterfaceDeclaration" === nodeType || "OpaqueType" === nodeType || "TypeAlias" === nodeType || "EnumDeclaration" === nodeType || "TSDeclareFunction" === nodeType || "TSInterfaceDeclaration" === nodeType || "TSTypeAliasDeclaration" === nodeType || "TSEnumDeclaration" === nodeType || "TSModuleDeclaration" === nodeType || "TSImportEqualsDeclaration" === nodeType || "TSExportAssignment" === nodeType || "TSNamespaceExportDeclaration" === nodeType || nodeType === "Placeholder" && ("Statement" === node.expectedNode || "Declaration" === node.expectedNode || "BlockStatement" === node.expectedNode)) {
|
---|
4074 | if (typeof opts === "undefined") {
|
---|
4075 | return true;
|
---|
4076 | } else {
|
---|
4077 | return (0, _shallowEqual.default)(node, opts);
|
---|
4078 | }
|
---|
4079 | }
|
---|
4080 |
|
---|
4081 | return false;
|
---|
4082 | }
|
---|
4083 |
|
---|
4084 | function isTerminatorless(node, opts) {
|
---|
4085 | if (!node) return false;
|
---|
4086 | const nodeType = node.type;
|
---|
4087 |
|
---|
4088 | if ("BreakStatement" === nodeType || "ContinueStatement" === nodeType || "ReturnStatement" === nodeType || "ThrowStatement" === nodeType || "YieldExpression" === nodeType || "AwaitExpression" === nodeType) {
|
---|
4089 | if (typeof opts === "undefined") {
|
---|
4090 | return true;
|
---|
4091 | } else {
|
---|
4092 | return (0, _shallowEqual.default)(node, opts);
|
---|
4093 | }
|
---|
4094 | }
|
---|
4095 |
|
---|
4096 | return false;
|
---|
4097 | }
|
---|
4098 |
|
---|
4099 | function isCompletionStatement(node, opts) {
|
---|
4100 | if (!node) return false;
|
---|
4101 | const nodeType = node.type;
|
---|
4102 |
|
---|
4103 | if ("BreakStatement" === nodeType || "ContinueStatement" === nodeType || "ReturnStatement" === nodeType || "ThrowStatement" === nodeType) {
|
---|
4104 | if (typeof opts === "undefined") {
|
---|
4105 | return true;
|
---|
4106 | } else {
|
---|
4107 | return (0, _shallowEqual.default)(node, opts);
|
---|
4108 | }
|
---|
4109 | }
|
---|
4110 |
|
---|
4111 | return false;
|
---|
4112 | }
|
---|
4113 |
|
---|
4114 | function isConditional(node, opts) {
|
---|
4115 | if (!node) return false;
|
---|
4116 | const nodeType = node.type;
|
---|
4117 |
|
---|
4118 | if ("ConditionalExpression" === nodeType || "IfStatement" === nodeType) {
|
---|
4119 | if (typeof opts === "undefined") {
|
---|
4120 | return true;
|
---|
4121 | } else {
|
---|
4122 | return (0, _shallowEqual.default)(node, opts);
|
---|
4123 | }
|
---|
4124 | }
|
---|
4125 |
|
---|
4126 | return false;
|
---|
4127 | }
|
---|
4128 |
|
---|
4129 | function isLoop(node, opts) {
|
---|
4130 | if (!node) return false;
|
---|
4131 | const nodeType = node.type;
|
---|
4132 |
|
---|
4133 | if ("DoWhileStatement" === nodeType || "ForInStatement" === nodeType || "ForStatement" === nodeType || "WhileStatement" === nodeType || "ForOfStatement" === nodeType) {
|
---|
4134 | if (typeof opts === "undefined") {
|
---|
4135 | return true;
|
---|
4136 | } else {
|
---|
4137 | return (0, _shallowEqual.default)(node, opts);
|
---|
4138 | }
|
---|
4139 | }
|
---|
4140 |
|
---|
4141 | return false;
|
---|
4142 | }
|
---|
4143 |
|
---|
4144 | function isWhile(node, opts) {
|
---|
4145 | if (!node) return false;
|
---|
4146 | const nodeType = node.type;
|
---|
4147 |
|
---|
4148 | if ("DoWhileStatement" === nodeType || "WhileStatement" === nodeType) {
|
---|
4149 | if (typeof opts === "undefined") {
|
---|
4150 | return true;
|
---|
4151 | } else {
|
---|
4152 | return (0, _shallowEqual.default)(node, opts);
|
---|
4153 | }
|
---|
4154 | }
|
---|
4155 |
|
---|
4156 | return false;
|
---|
4157 | }
|
---|
4158 |
|
---|
4159 | function isExpressionWrapper(node, opts) {
|
---|
4160 | if (!node) return false;
|
---|
4161 | const nodeType = node.type;
|
---|
4162 |
|
---|
4163 | if ("ExpressionStatement" === nodeType || "ParenthesizedExpression" === nodeType || "TypeCastExpression" === nodeType) {
|
---|
4164 | if (typeof opts === "undefined") {
|
---|
4165 | return true;
|
---|
4166 | } else {
|
---|
4167 | return (0, _shallowEqual.default)(node, opts);
|
---|
4168 | }
|
---|
4169 | }
|
---|
4170 |
|
---|
4171 | return false;
|
---|
4172 | }
|
---|
4173 |
|
---|
4174 | function isFor(node, opts) {
|
---|
4175 | if (!node) return false;
|
---|
4176 | const nodeType = node.type;
|
---|
4177 |
|
---|
4178 | if ("ForInStatement" === nodeType || "ForStatement" === nodeType || "ForOfStatement" === nodeType) {
|
---|
4179 | if (typeof opts === "undefined") {
|
---|
4180 | return true;
|
---|
4181 | } else {
|
---|
4182 | return (0, _shallowEqual.default)(node, opts);
|
---|
4183 | }
|
---|
4184 | }
|
---|
4185 |
|
---|
4186 | return false;
|
---|
4187 | }
|
---|
4188 |
|
---|
4189 | function isForXStatement(node, opts) {
|
---|
4190 | if (!node) return false;
|
---|
4191 | const nodeType = node.type;
|
---|
4192 |
|
---|
4193 | if ("ForInStatement" === nodeType || "ForOfStatement" === nodeType) {
|
---|
4194 | if (typeof opts === "undefined") {
|
---|
4195 | return true;
|
---|
4196 | } else {
|
---|
4197 | return (0, _shallowEqual.default)(node, opts);
|
---|
4198 | }
|
---|
4199 | }
|
---|
4200 |
|
---|
4201 | return false;
|
---|
4202 | }
|
---|
4203 |
|
---|
4204 | function isFunction(node, opts) {
|
---|
4205 | if (!node) return false;
|
---|
4206 | const nodeType = node.type;
|
---|
4207 |
|
---|
4208 | if ("FunctionDeclaration" === nodeType || "FunctionExpression" === nodeType || "ObjectMethod" === nodeType || "ArrowFunctionExpression" === nodeType || "ClassMethod" === nodeType || "ClassPrivateMethod" === nodeType) {
|
---|
4209 | if (typeof opts === "undefined") {
|
---|
4210 | return true;
|
---|
4211 | } else {
|
---|
4212 | return (0, _shallowEqual.default)(node, opts);
|
---|
4213 | }
|
---|
4214 | }
|
---|
4215 |
|
---|
4216 | return false;
|
---|
4217 | }
|
---|
4218 |
|
---|
4219 | function isFunctionParent(node, opts) {
|
---|
4220 | if (!node) return false;
|
---|
4221 | const nodeType = node.type;
|
---|
4222 |
|
---|
4223 | if ("FunctionDeclaration" === nodeType || "FunctionExpression" === nodeType || "ObjectMethod" === nodeType || "ArrowFunctionExpression" === nodeType || "ClassMethod" === nodeType || "ClassPrivateMethod" === nodeType) {
|
---|
4224 | if (typeof opts === "undefined") {
|
---|
4225 | return true;
|
---|
4226 | } else {
|
---|
4227 | return (0, _shallowEqual.default)(node, opts);
|
---|
4228 | }
|
---|
4229 | }
|
---|
4230 |
|
---|
4231 | return false;
|
---|
4232 | }
|
---|
4233 |
|
---|
4234 | function isPureish(node, opts) {
|
---|
4235 | if (!node) return false;
|
---|
4236 | const nodeType = node.type;
|
---|
4237 |
|
---|
4238 | if ("FunctionDeclaration" === nodeType || "FunctionExpression" === nodeType || "StringLiteral" === nodeType || "NumericLiteral" === nodeType || "NullLiteral" === nodeType || "BooleanLiteral" === nodeType || "RegExpLiteral" === nodeType || "ArrowFunctionExpression" === nodeType || "BigIntLiteral" === nodeType || "DecimalLiteral" === nodeType || nodeType === "Placeholder" && "StringLiteral" === node.expectedNode) {
|
---|
4239 | if (typeof opts === "undefined") {
|
---|
4240 | return true;
|
---|
4241 | } else {
|
---|
4242 | return (0, _shallowEqual.default)(node, opts);
|
---|
4243 | }
|
---|
4244 | }
|
---|
4245 |
|
---|
4246 | return false;
|
---|
4247 | }
|
---|
4248 |
|
---|
4249 | function isDeclaration(node, opts) {
|
---|
4250 | if (!node) return false;
|
---|
4251 | const nodeType = node.type;
|
---|
4252 |
|
---|
4253 | if ("FunctionDeclaration" === nodeType || "VariableDeclaration" === nodeType || "ClassDeclaration" === nodeType || "ExportAllDeclaration" === nodeType || "ExportDefaultDeclaration" === nodeType || "ExportNamedDeclaration" === nodeType || "ImportDeclaration" === nodeType || "DeclareClass" === nodeType || "DeclareFunction" === nodeType || "DeclareInterface" === nodeType || "DeclareModule" === nodeType || "DeclareModuleExports" === nodeType || "DeclareTypeAlias" === nodeType || "DeclareOpaqueType" === nodeType || "DeclareVariable" === nodeType || "DeclareExportDeclaration" === nodeType || "DeclareExportAllDeclaration" === nodeType || "InterfaceDeclaration" === nodeType || "OpaqueType" === nodeType || "TypeAlias" === nodeType || "EnumDeclaration" === nodeType || "TSDeclareFunction" === nodeType || "TSInterfaceDeclaration" === nodeType || "TSTypeAliasDeclaration" === nodeType || "TSEnumDeclaration" === nodeType || "TSModuleDeclaration" === nodeType || nodeType === "Placeholder" && "Declaration" === node.expectedNode) {
|
---|
4254 | if (typeof opts === "undefined") {
|
---|
4255 | return true;
|
---|
4256 | } else {
|
---|
4257 | return (0, _shallowEqual.default)(node, opts);
|
---|
4258 | }
|
---|
4259 | }
|
---|
4260 |
|
---|
4261 | return false;
|
---|
4262 | }
|
---|
4263 |
|
---|
4264 | function isPatternLike(node, opts) {
|
---|
4265 | if (!node) return false;
|
---|
4266 | const nodeType = node.type;
|
---|
4267 |
|
---|
4268 | if ("Identifier" === nodeType || "RestElement" === nodeType || "AssignmentPattern" === nodeType || "ArrayPattern" === nodeType || "ObjectPattern" === nodeType || nodeType === "Placeholder" && ("Pattern" === node.expectedNode || "Identifier" === node.expectedNode)) {
|
---|
4269 | if (typeof opts === "undefined") {
|
---|
4270 | return true;
|
---|
4271 | } else {
|
---|
4272 | return (0, _shallowEqual.default)(node, opts);
|
---|
4273 | }
|
---|
4274 | }
|
---|
4275 |
|
---|
4276 | return false;
|
---|
4277 | }
|
---|
4278 |
|
---|
4279 | function isLVal(node, opts) {
|
---|
4280 | if (!node) return false;
|
---|
4281 | const nodeType = node.type;
|
---|
4282 |
|
---|
4283 | if ("Identifier" === nodeType || "MemberExpression" === nodeType || "RestElement" === nodeType || "AssignmentPattern" === nodeType || "ArrayPattern" === nodeType || "ObjectPattern" === nodeType || "TSParameterProperty" === nodeType || nodeType === "Placeholder" && ("Pattern" === node.expectedNode || "Identifier" === node.expectedNode)) {
|
---|
4284 | if (typeof opts === "undefined") {
|
---|
4285 | return true;
|
---|
4286 | } else {
|
---|
4287 | return (0, _shallowEqual.default)(node, opts);
|
---|
4288 | }
|
---|
4289 | }
|
---|
4290 |
|
---|
4291 | return false;
|
---|
4292 | }
|
---|
4293 |
|
---|
4294 | function isTSEntityName(node, opts) {
|
---|
4295 | if (!node) return false;
|
---|
4296 | const nodeType = node.type;
|
---|
4297 |
|
---|
4298 | if ("Identifier" === nodeType || "TSQualifiedName" === nodeType || nodeType === "Placeholder" && "Identifier" === node.expectedNode) {
|
---|
4299 | if (typeof opts === "undefined") {
|
---|
4300 | return true;
|
---|
4301 | } else {
|
---|
4302 | return (0, _shallowEqual.default)(node, opts);
|
---|
4303 | }
|
---|
4304 | }
|
---|
4305 |
|
---|
4306 | return false;
|
---|
4307 | }
|
---|
4308 |
|
---|
4309 | function isLiteral(node, opts) {
|
---|
4310 | if (!node) return false;
|
---|
4311 | const nodeType = node.type;
|
---|
4312 |
|
---|
4313 | if ("StringLiteral" === nodeType || "NumericLiteral" === nodeType || "NullLiteral" === nodeType || "BooleanLiteral" === nodeType || "RegExpLiteral" === nodeType || "TemplateLiteral" === nodeType || "BigIntLiteral" === nodeType || "DecimalLiteral" === nodeType || nodeType === "Placeholder" && "StringLiteral" === node.expectedNode) {
|
---|
4314 | if (typeof opts === "undefined") {
|
---|
4315 | return true;
|
---|
4316 | } else {
|
---|
4317 | return (0, _shallowEqual.default)(node, opts);
|
---|
4318 | }
|
---|
4319 | }
|
---|
4320 |
|
---|
4321 | return false;
|
---|
4322 | }
|
---|
4323 |
|
---|
4324 | function isImmutable(node, opts) {
|
---|
4325 | if (!node) return false;
|
---|
4326 | const nodeType = node.type;
|
---|
4327 |
|
---|
4328 | if ("StringLiteral" === nodeType || "NumericLiteral" === nodeType || "NullLiteral" === nodeType || "BooleanLiteral" === nodeType || "BigIntLiteral" === nodeType || "JSXAttribute" === nodeType || "JSXClosingElement" === nodeType || "JSXElement" === nodeType || "JSXExpressionContainer" === nodeType || "JSXSpreadChild" === nodeType || "JSXOpeningElement" === nodeType || "JSXText" === nodeType || "JSXFragment" === nodeType || "JSXOpeningFragment" === nodeType || "JSXClosingFragment" === nodeType || "DecimalLiteral" === nodeType || nodeType === "Placeholder" && "StringLiteral" === node.expectedNode) {
|
---|
4329 | if (typeof opts === "undefined") {
|
---|
4330 | return true;
|
---|
4331 | } else {
|
---|
4332 | return (0, _shallowEqual.default)(node, opts);
|
---|
4333 | }
|
---|
4334 | }
|
---|
4335 |
|
---|
4336 | return false;
|
---|
4337 | }
|
---|
4338 |
|
---|
4339 | function isUserWhitespacable(node, opts) {
|
---|
4340 | if (!node) return false;
|
---|
4341 | const nodeType = node.type;
|
---|
4342 |
|
---|
4343 | if ("ObjectMethod" === nodeType || "ObjectProperty" === nodeType || "ObjectTypeInternalSlot" === nodeType || "ObjectTypeCallProperty" === nodeType || "ObjectTypeIndexer" === nodeType || "ObjectTypeProperty" === nodeType || "ObjectTypeSpreadProperty" === nodeType) {
|
---|
4344 | if (typeof opts === "undefined") {
|
---|
4345 | return true;
|
---|
4346 | } else {
|
---|
4347 | return (0, _shallowEqual.default)(node, opts);
|
---|
4348 | }
|
---|
4349 | }
|
---|
4350 |
|
---|
4351 | return false;
|
---|
4352 | }
|
---|
4353 |
|
---|
4354 | function isMethod(node, opts) {
|
---|
4355 | if (!node) return false;
|
---|
4356 | const nodeType = node.type;
|
---|
4357 |
|
---|
4358 | if ("ObjectMethod" === nodeType || "ClassMethod" === nodeType || "ClassPrivateMethod" === nodeType) {
|
---|
4359 | if (typeof opts === "undefined") {
|
---|
4360 | return true;
|
---|
4361 | } else {
|
---|
4362 | return (0, _shallowEqual.default)(node, opts);
|
---|
4363 | }
|
---|
4364 | }
|
---|
4365 |
|
---|
4366 | return false;
|
---|
4367 | }
|
---|
4368 |
|
---|
4369 | function isObjectMember(node, opts) {
|
---|
4370 | if (!node) return false;
|
---|
4371 | const nodeType = node.type;
|
---|
4372 |
|
---|
4373 | if ("ObjectMethod" === nodeType || "ObjectProperty" === nodeType) {
|
---|
4374 | if (typeof opts === "undefined") {
|
---|
4375 | return true;
|
---|
4376 | } else {
|
---|
4377 | return (0, _shallowEqual.default)(node, opts);
|
---|
4378 | }
|
---|
4379 | }
|
---|
4380 |
|
---|
4381 | return false;
|
---|
4382 | }
|
---|
4383 |
|
---|
4384 | function isProperty(node, opts) {
|
---|
4385 | if (!node) return false;
|
---|
4386 | const nodeType = node.type;
|
---|
4387 |
|
---|
4388 | if ("ObjectProperty" === nodeType || "ClassProperty" === nodeType || "ClassPrivateProperty" === nodeType) {
|
---|
4389 | if (typeof opts === "undefined") {
|
---|
4390 | return true;
|
---|
4391 | } else {
|
---|
4392 | return (0, _shallowEqual.default)(node, opts);
|
---|
4393 | }
|
---|
4394 | }
|
---|
4395 |
|
---|
4396 | return false;
|
---|
4397 | }
|
---|
4398 |
|
---|
4399 | function isUnaryLike(node, opts) {
|
---|
4400 | if (!node) return false;
|
---|
4401 | const nodeType = node.type;
|
---|
4402 |
|
---|
4403 | if ("UnaryExpression" === nodeType || "SpreadElement" === nodeType) {
|
---|
4404 | if (typeof opts === "undefined") {
|
---|
4405 | return true;
|
---|
4406 | } else {
|
---|
4407 | return (0, _shallowEqual.default)(node, opts);
|
---|
4408 | }
|
---|
4409 | }
|
---|
4410 |
|
---|
4411 | return false;
|
---|
4412 | }
|
---|
4413 |
|
---|
4414 | function isPattern(node, opts) {
|
---|
4415 | if (!node) return false;
|
---|
4416 | const nodeType = node.type;
|
---|
4417 |
|
---|
4418 | if ("AssignmentPattern" === nodeType || "ArrayPattern" === nodeType || "ObjectPattern" === nodeType || nodeType === "Placeholder" && "Pattern" === node.expectedNode) {
|
---|
4419 | if (typeof opts === "undefined") {
|
---|
4420 | return true;
|
---|
4421 | } else {
|
---|
4422 | return (0, _shallowEqual.default)(node, opts);
|
---|
4423 | }
|
---|
4424 | }
|
---|
4425 |
|
---|
4426 | return false;
|
---|
4427 | }
|
---|
4428 |
|
---|
4429 | function isClass(node, opts) {
|
---|
4430 | if (!node) return false;
|
---|
4431 | const nodeType = node.type;
|
---|
4432 |
|
---|
4433 | if ("ClassExpression" === nodeType || "ClassDeclaration" === nodeType) {
|
---|
4434 | if (typeof opts === "undefined") {
|
---|
4435 | return true;
|
---|
4436 | } else {
|
---|
4437 | return (0, _shallowEqual.default)(node, opts);
|
---|
4438 | }
|
---|
4439 | }
|
---|
4440 |
|
---|
4441 | return false;
|
---|
4442 | }
|
---|
4443 |
|
---|
4444 | function isModuleDeclaration(node, opts) {
|
---|
4445 | if (!node) return false;
|
---|
4446 | const nodeType = node.type;
|
---|
4447 |
|
---|
4448 | if ("ExportAllDeclaration" === nodeType || "ExportDefaultDeclaration" === nodeType || "ExportNamedDeclaration" === nodeType || "ImportDeclaration" === nodeType) {
|
---|
4449 | if (typeof opts === "undefined") {
|
---|
4450 | return true;
|
---|
4451 | } else {
|
---|
4452 | return (0, _shallowEqual.default)(node, opts);
|
---|
4453 | }
|
---|
4454 | }
|
---|
4455 |
|
---|
4456 | return false;
|
---|
4457 | }
|
---|
4458 |
|
---|
4459 | function isExportDeclaration(node, opts) {
|
---|
4460 | if (!node) return false;
|
---|
4461 | const nodeType = node.type;
|
---|
4462 |
|
---|
4463 | if ("ExportAllDeclaration" === nodeType || "ExportDefaultDeclaration" === nodeType || "ExportNamedDeclaration" === nodeType) {
|
---|
4464 | if (typeof opts === "undefined") {
|
---|
4465 | return true;
|
---|
4466 | } else {
|
---|
4467 | return (0, _shallowEqual.default)(node, opts);
|
---|
4468 | }
|
---|
4469 | }
|
---|
4470 |
|
---|
4471 | return false;
|
---|
4472 | }
|
---|
4473 |
|
---|
4474 | function isModuleSpecifier(node, opts) {
|
---|
4475 | if (!node) return false;
|
---|
4476 | const nodeType = node.type;
|
---|
4477 |
|
---|
4478 | if ("ExportSpecifier" === nodeType || "ImportDefaultSpecifier" === nodeType || "ImportNamespaceSpecifier" === nodeType || "ImportSpecifier" === nodeType || "ExportNamespaceSpecifier" === nodeType || "ExportDefaultSpecifier" === nodeType) {
|
---|
4479 | if (typeof opts === "undefined") {
|
---|
4480 | return true;
|
---|
4481 | } else {
|
---|
4482 | return (0, _shallowEqual.default)(node, opts);
|
---|
4483 | }
|
---|
4484 | }
|
---|
4485 |
|
---|
4486 | return false;
|
---|
4487 | }
|
---|
4488 |
|
---|
4489 | function isPrivate(node, opts) {
|
---|
4490 | if (!node) return false;
|
---|
4491 | const nodeType = node.type;
|
---|
4492 |
|
---|
4493 | if ("ClassPrivateProperty" === nodeType || "ClassPrivateMethod" === nodeType || "PrivateName" === nodeType) {
|
---|
4494 | if (typeof opts === "undefined") {
|
---|
4495 | return true;
|
---|
4496 | } else {
|
---|
4497 | return (0, _shallowEqual.default)(node, opts);
|
---|
4498 | }
|
---|
4499 | }
|
---|
4500 |
|
---|
4501 | return false;
|
---|
4502 | }
|
---|
4503 |
|
---|
4504 | function isFlow(node, opts) {
|
---|
4505 | if (!node) return false;
|
---|
4506 | const nodeType = node.type;
|
---|
4507 |
|
---|
4508 | if ("AnyTypeAnnotation" === nodeType || "ArrayTypeAnnotation" === nodeType || "BooleanTypeAnnotation" === nodeType || "BooleanLiteralTypeAnnotation" === nodeType || "NullLiteralTypeAnnotation" === nodeType || "ClassImplements" === nodeType || "DeclareClass" === nodeType || "DeclareFunction" === nodeType || "DeclareInterface" === nodeType || "DeclareModule" === nodeType || "DeclareModuleExports" === nodeType || "DeclareTypeAlias" === nodeType || "DeclareOpaqueType" === nodeType || "DeclareVariable" === nodeType || "DeclareExportDeclaration" === nodeType || "DeclareExportAllDeclaration" === nodeType || "DeclaredPredicate" === nodeType || "ExistsTypeAnnotation" === nodeType || "FunctionTypeAnnotation" === nodeType || "FunctionTypeParam" === nodeType || "GenericTypeAnnotation" === nodeType || "InferredPredicate" === nodeType || "InterfaceExtends" === nodeType || "InterfaceDeclaration" === nodeType || "InterfaceTypeAnnotation" === nodeType || "IntersectionTypeAnnotation" === nodeType || "MixedTypeAnnotation" === nodeType || "EmptyTypeAnnotation" === nodeType || "NullableTypeAnnotation" === nodeType || "NumberLiteralTypeAnnotation" === nodeType || "NumberTypeAnnotation" === nodeType || "ObjectTypeAnnotation" === nodeType || "ObjectTypeInternalSlot" === nodeType || "ObjectTypeCallProperty" === nodeType || "ObjectTypeIndexer" === nodeType || "ObjectTypeProperty" === nodeType || "ObjectTypeSpreadProperty" === nodeType || "OpaqueType" === nodeType || "QualifiedTypeIdentifier" === nodeType || "StringLiteralTypeAnnotation" === nodeType || "StringTypeAnnotation" === nodeType || "SymbolTypeAnnotation" === nodeType || "ThisTypeAnnotation" === nodeType || "TupleTypeAnnotation" === nodeType || "TypeofTypeAnnotation" === nodeType || "TypeAlias" === nodeType || "TypeAnnotation" === nodeType || "TypeCastExpression" === nodeType || "TypeParameter" === nodeType || "TypeParameterDeclaration" === nodeType || "TypeParameterInstantiation" === nodeType || "UnionTypeAnnotation" === nodeType || "Variance" === nodeType || "VoidTypeAnnotation" === nodeType || "IndexedAccessType" === nodeType || "OptionalIndexedAccessType" === nodeType) {
|
---|
4509 | if (typeof opts === "undefined") {
|
---|
4510 | return true;
|
---|
4511 | } else {
|
---|
4512 | return (0, _shallowEqual.default)(node, opts);
|
---|
4513 | }
|
---|
4514 | }
|
---|
4515 |
|
---|
4516 | return false;
|
---|
4517 | }
|
---|
4518 |
|
---|
4519 | function isFlowType(node, opts) {
|
---|
4520 | if (!node) return false;
|
---|
4521 | const nodeType = node.type;
|
---|
4522 |
|
---|
4523 | if ("AnyTypeAnnotation" === nodeType || "ArrayTypeAnnotation" === nodeType || "BooleanTypeAnnotation" === nodeType || "BooleanLiteralTypeAnnotation" === nodeType || "NullLiteralTypeAnnotation" === nodeType || "ExistsTypeAnnotation" === nodeType || "FunctionTypeAnnotation" === nodeType || "GenericTypeAnnotation" === nodeType || "InterfaceTypeAnnotation" === nodeType || "IntersectionTypeAnnotation" === nodeType || "MixedTypeAnnotation" === nodeType || "EmptyTypeAnnotation" === nodeType || "NullableTypeAnnotation" === nodeType || "NumberLiteralTypeAnnotation" === nodeType || "NumberTypeAnnotation" === nodeType || "ObjectTypeAnnotation" === nodeType || "StringLiteralTypeAnnotation" === nodeType || "StringTypeAnnotation" === nodeType || "SymbolTypeAnnotation" === nodeType || "ThisTypeAnnotation" === nodeType || "TupleTypeAnnotation" === nodeType || "TypeofTypeAnnotation" === nodeType || "UnionTypeAnnotation" === nodeType || "VoidTypeAnnotation" === nodeType || "IndexedAccessType" === nodeType || "OptionalIndexedAccessType" === nodeType) {
|
---|
4524 | if (typeof opts === "undefined") {
|
---|
4525 | return true;
|
---|
4526 | } else {
|
---|
4527 | return (0, _shallowEqual.default)(node, opts);
|
---|
4528 | }
|
---|
4529 | }
|
---|
4530 |
|
---|
4531 | return false;
|
---|
4532 | }
|
---|
4533 |
|
---|
4534 | function isFlowBaseAnnotation(node, opts) {
|
---|
4535 | if (!node) return false;
|
---|
4536 | const nodeType = node.type;
|
---|
4537 |
|
---|
4538 | if ("AnyTypeAnnotation" === nodeType || "BooleanTypeAnnotation" === nodeType || "NullLiteralTypeAnnotation" === nodeType || "MixedTypeAnnotation" === nodeType || "EmptyTypeAnnotation" === nodeType || "NumberTypeAnnotation" === nodeType || "StringTypeAnnotation" === nodeType || "SymbolTypeAnnotation" === nodeType || "ThisTypeAnnotation" === nodeType || "VoidTypeAnnotation" === nodeType) {
|
---|
4539 | if (typeof opts === "undefined") {
|
---|
4540 | return true;
|
---|
4541 | } else {
|
---|
4542 | return (0, _shallowEqual.default)(node, opts);
|
---|
4543 | }
|
---|
4544 | }
|
---|
4545 |
|
---|
4546 | return false;
|
---|
4547 | }
|
---|
4548 |
|
---|
4549 | function isFlowDeclaration(node, opts) {
|
---|
4550 | if (!node) return false;
|
---|
4551 | const nodeType = node.type;
|
---|
4552 |
|
---|
4553 | if ("DeclareClass" === nodeType || "DeclareFunction" === nodeType || "DeclareInterface" === nodeType || "DeclareModule" === nodeType || "DeclareModuleExports" === nodeType || "DeclareTypeAlias" === nodeType || "DeclareOpaqueType" === nodeType || "DeclareVariable" === nodeType || "DeclareExportDeclaration" === nodeType || "DeclareExportAllDeclaration" === nodeType || "InterfaceDeclaration" === nodeType || "OpaqueType" === nodeType || "TypeAlias" === nodeType) {
|
---|
4554 | if (typeof opts === "undefined") {
|
---|
4555 | return true;
|
---|
4556 | } else {
|
---|
4557 | return (0, _shallowEqual.default)(node, opts);
|
---|
4558 | }
|
---|
4559 | }
|
---|
4560 |
|
---|
4561 | return false;
|
---|
4562 | }
|
---|
4563 |
|
---|
4564 | function isFlowPredicate(node, opts) {
|
---|
4565 | if (!node) return false;
|
---|
4566 | const nodeType = node.type;
|
---|
4567 |
|
---|
4568 | if ("DeclaredPredicate" === nodeType || "InferredPredicate" === nodeType) {
|
---|
4569 | if (typeof opts === "undefined") {
|
---|
4570 | return true;
|
---|
4571 | } else {
|
---|
4572 | return (0, _shallowEqual.default)(node, opts);
|
---|
4573 | }
|
---|
4574 | }
|
---|
4575 |
|
---|
4576 | return false;
|
---|
4577 | }
|
---|
4578 |
|
---|
4579 | function isEnumBody(node, opts) {
|
---|
4580 | if (!node) return false;
|
---|
4581 | const nodeType = node.type;
|
---|
4582 |
|
---|
4583 | if ("EnumBooleanBody" === nodeType || "EnumNumberBody" === nodeType || "EnumStringBody" === nodeType || "EnumSymbolBody" === nodeType) {
|
---|
4584 | if (typeof opts === "undefined") {
|
---|
4585 | return true;
|
---|
4586 | } else {
|
---|
4587 | return (0, _shallowEqual.default)(node, opts);
|
---|
4588 | }
|
---|
4589 | }
|
---|
4590 |
|
---|
4591 | return false;
|
---|
4592 | }
|
---|
4593 |
|
---|
4594 | function isEnumMember(node, opts) {
|
---|
4595 | if (!node) return false;
|
---|
4596 | const nodeType = node.type;
|
---|
4597 |
|
---|
4598 | if ("EnumBooleanMember" === nodeType || "EnumNumberMember" === nodeType || "EnumStringMember" === nodeType || "EnumDefaultedMember" === nodeType) {
|
---|
4599 | if (typeof opts === "undefined") {
|
---|
4600 | return true;
|
---|
4601 | } else {
|
---|
4602 | return (0, _shallowEqual.default)(node, opts);
|
---|
4603 | }
|
---|
4604 | }
|
---|
4605 |
|
---|
4606 | return false;
|
---|
4607 | }
|
---|
4608 |
|
---|
4609 | function isJSX(node, opts) {
|
---|
4610 | if (!node) return false;
|
---|
4611 | const nodeType = node.type;
|
---|
4612 |
|
---|
4613 | if ("JSXAttribute" === nodeType || "JSXClosingElement" === nodeType || "JSXElement" === nodeType || "JSXEmptyExpression" === nodeType || "JSXExpressionContainer" === nodeType || "JSXSpreadChild" === nodeType || "JSXIdentifier" === nodeType || "JSXMemberExpression" === nodeType || "JSXNamespacedName" === nodeType || "JSXOpeningElement" === nodeType || "JSXSpreadAttribute" === nodeType || "JSXText" === nodeType || "JSXFragment" === nodeType || "JSXOpeningFragment" === nodeType || "JSXClosingFragment" === nodeType) {
|
---|
4614 | if (typeof opts === "undefined") {
|
---|
4615 | return true;
|
---|
4616 | } else {
|
---|
4617 | return (0, _shallowEqual.default)(node, opts);
|
---|
4618 | }
|
---|
4619 | }
|
---|
4620 |
|
---|
4621 | return false;
|
---|
4622 | }
|
---|
4623 |
|
---|
4624 | function isTSTypeElement(node, opts) {
|
---|
4625 | if (!node) return false;
|
---|
4626 | const nodeType = node.type;
|
---|
4627 |
|
---|
4628 | if ("TSCallSignatureDeclaration" === nodeType || "TSConstructSignatureDeclaration" === nodeType || "TSPropertySignature" === nodeType || "TSMethodSignature" === nodeType || "TSIndexSignature" === nodeType) {
|
---|
4629 | if (typeof opts === "undefined") {
|
---|
4630 | return true;
|
---|
4631 | } else {
|
---|
4632 | return (0, _shallowEqual.default)(node, opts);
|
---|
4633 | }
|
---|
4634 | }
|
---|
4635 |
|
---|
4636 | return false;
|
---|
4637 | }
|
---|
4638 |
|
---|
4639 | function isTSType(node, opts) {
|
---|
4640 | if (!node) return false;
|
---|
4641 | const nodeType = node.type;
|
---|
4642 |
|
---|
4643 | if ("TSAnyKeyword" === nodeType || "TSBooleanKeyword" === nodeType || "TSBigIntKeyword" === nodeType || "TSIntrinsicKeyword" === nodeType || "TSNeverKeyword" === nodeType || "TSNullKeyword" === nodeType || "TSNumberKeyword" === nodeType || "TSObjectKeyword" === nodeType || "TSStringKeyword" === nodeType || "TSSymbolKeyword" === nodeType || "TSUndefinedKeyword" === nodeType || "TSUnknownKeyword" === nodeType || "TSVoidKeyword" === nodeType || "TSThisType" === nodeType || "TSFunctionType" === nodeType || "TSConstructorType" === nodeType || "TSTypeReference" === nodeType || "TSTypePredicate" === nodeType || "TSTypeQuery" === nodeType || "TSTypeLiteral" === nodeType || "TSArrayType" === nodeType || "TSTupleType" === nodeType || "TSOptionalType" === nodeType || "TSRestType" === nodeType || "TSUnionType" === nodeType || "TSIntersectionType" === nodeType || "TSConditionalType" === nodeType || "TSInferType" === nodeType || "TSParenthesizedType" === nodeType || "TSTypeOperator" === nodeType || "TSIndexedAccessType" === nodeType || "TSMappedType" === nodeType || "TSLiteralType" === nodeType || "TSExpressionWithTypeArguments" === nodeType || "TSImportType" === nodeType) {
|
---|
4644 | if (typeof opts === "undefined") {
|
---|
4645 | return true;
|
---|
4646 | } else {
|
---|
4647 | return (0, _shallowEqual.default)(node, opts);
|
---|
4648 | }
|
---|
4649 | }
|
---|
4650 |
|
---|
4651 | return false;
|
---|
4652 | }
|
---|
4653 |
|
---|
4654 | function isTSBaseType(node, opts) {
|
---|
4655 | if (!node) return false;
|
---|
4656 | const nodeType = node.type;
|
---|
4657 |
|
---|
4658 | if ("TSAnyKeyword" === nodeType || "TSBooleanKeyword" === nodeType || "TSBigIntKeyword" === nodeType || "TSIntrinsicKeyword" === nodeType || "TSNeverKeyword" === nodeType || "TSNullKeyword" === nodeType || "TSNumberKeyword" === nodeType || "TSObjectKeyword" === nodeType || "TSStringKeyword" === nodeType || "TSSymbolKeyword" === nodeType || "TSUndefinedKeyword" === nodeType || "TSUnknownKeyword" === nodeType || "TSVoidKeyword" === nodeType || "TSThisType" === nodeType || "TSLiteralType" === nodeType) {
|
---|
4659 | if (typeof opts === "undefined") {
|
---|
4660 | return true;
|
---|
4661 | } else {
|
---|
4662 | return (0, _shallowEqual.default)(node, opts);
|
---|
4663 | }
|
---|
4664 | }
|
---|
4665 |
|
---|
4666 | return false;
|
---|
4667 | }
|
---|
4668 |
|
---|
4669 | function isNumberLiteral(node, opts) {
|
---|
4670 | console.trace("The node type NumberLiteral has been renamed to NumericLiteral");
|
---|
4671 | if (!node) return false;
|
---|
4672 | const nodeType = node.type;
|
---|
4673 |
|
---|
4674 | if (nodeType === "NumberLiteral") {
|
---|
4675 | if (typeof opts === "undefined") {
|
---|
4676 | return true;
|
---|
4677 | } else {
|
---|
4678 | return (0, _shallowEqual.default)(node, opts);
|
---|
4679 | }
|
---|
4680 | }
|
---|
4681 |
|
---|
4682 | return false;
|
---|
4683 | }
|
---|
4684 |
|
---|
4685 | function isRegexLiteral(node, opts) {
|
---|
4686 | console.trace("The node type RegexLiteral has been renamed to RegExpLiteral");
|
---|
4687 | if (!node) return false;
|
---|
4688 | const nodeType = node.type;
|
---|
4689 |
|
---|
4690 | if (nodeType === "RegexLiteral") {
|
---|
4691 | if (typeof opts === "undefined") {
|
---|
4692 | return true;
|
---|
4693 | } else {
|
---|
4694 | return (0, _shallowEqual.default)(node, opts);
|
---|
4695 | }
|
---|
4696 | }
|
---|
4697 |
|
---|
4698 | return false;
|
---|
4699 | }
|
---|
4700 |
|
---|
4701 | function isRestProperty(node, opts) {
|
---|
4702 | console.trace("The node type RestProperty has been renamed to RestElement");
|
---|
4703 | if (!node) return false;
|
---|
4704 | const nodeType = node.type;
|
---|
4705 |
|
---|
4706 | if (nodeType === "RestProperty") {
|
---|
4707 | if (typeof opts === "undefined") {
|
---|
4708 | return true;
|
---|
4709 | } else {
|
---|
4710 | return (0, _shallowEqual.default)(node, opts);
|
---|
4711 | }
|
---|
4712 | }
|
---|
4713 |
|
---|
4714 | return false;
|
---|
4715 | }
|
---|
4716 |
|
---|
4717 | function isSpreadProperty(node, opts) {
|
---|
4718 | console.trace("The node type SpreadProperty has been renamed to SpreadElement");
|
---|
4719 | if (!node) return false;
|
---|
4720 | const nodeType = node.type;
|
---|
4721 |
|
---|
4722 | if (nodeType === "SpreadProperty") {
|
---|
4723 | if (typeof opts === "undefined") {
|
---|
4724 | return true;
|
---|
4725 | } else {
|
---|
4726 | return (0, _shallowEqual.default)(node, opts);
|
---|
4727 | }
|
---|
4728 | }
|
---|
4729 |
|
---|
4730 | return false;
|
---|
4731 | } |
---|