How to use shallowEqual method in Playwright Internal

Best JavaScript code snippet using playwright-internal

index.js

Source:index.js Github

copy

Full Screen

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

Full Screen

Full Screen

testSuites.js

Source:testSuites.js Github

copy

Full Screen

1const React = require('react');2const fn = () => {};3const promise = Promise.resolve('foo');4module.exports = [5 {6 description: 'primitives',7 tests: [8 {9 deepEqual: true,10 description: 'equal numbers',11 shallowEqual: true,12 value1: 1,13 value2: 1,14 },15 {16 deepEqual: false,17 description: 'not equal numbers',18 shallowEqual: false,19 value1: 1,20 value2: 2,21 },22 {23 deepEqual: true,24 description: 'equal zero',25 shallowEqual: true,26 value1: 0,27 value2: 0,28 },29 {30 deepEqual: true,31 description: 'equal positive and negative zero',32 shallowEqual: true,33 value1: -0,34 value2: 0,35 },36 {37 deepEqual: true,38 description: 'equal Infinity',39 shallowEqual: true,40 value1: Infinity,41 value2: Infinity,42 },43 {44 deepEqual: false,45 description: 'not equal Infinity',46 shallowEqual: false,47 value1: -Infinity,48 value2: Infinity,49 },50 {51 deepEqual: false,52 description: 'number and array are not equal',53 shallowEqual: false,54 value1: 1,55 value2: [],56 },57 {58 deepEqual: false,59 description: '0 and null are not equal',60 shallowEqual: false,61 value1: 0,62 value2: null,63 },64 {65 deepEqual: true,66 description: 'NaN and NaN are equal',67 shallowEqual: true,68 value1: NaN,69 value2: NaN,70 },71 {72 deepEqual: true,73 description: 'equal strings',74 shallowEqual: true,75 value1: 'a',76 value2: 'a',77 },78 {79 deepEqual: false,80 description: 'not equal strings',81 shallowEqual: false,82 value1: 'a',83 value2: 'b',84 },85 {86 deepEqual: false,87 description: 'empty string and null are not equal',88 shallowEqual: false,89 value1: '',90 value2: null,91 },92 {93 deepEqual: true,94 description: 'null is equal to null',95 shallowEqual: true,96 value1: null,97 value2: null,98 },99 {100 deepEqual: true,101 description: 'equal booleans (true)',102 shallowEqual: true,103 value1: true,104 value2: true,105 },106 {107 deepEqual: true,108 description: 'equal booleans (false)',109 shallowEqual: true,110 value1: false,111 value2: false,112 },113 {114 deepEqual: false,115 description: 'not equal booleans',116 shallowEqual: false,117 value1: true,118 value2: false,119 },120 {121 deepEqual: false,122 description: '1 and true are not equal',123 shallowEqual: false,124 value1: 1,125 value2: true,126 },127 {128 deepEqual: false,129 description: '0 and false are not equal',130 shallowEqual: false,131 value1: 0,132 value2: false,133 },134 ],135 },136 {137 description: 'functions',138 tests: [139 {140 deepEqual: true,141 description: 'function and the same function are equal',142 shallowEqual: true,143 value1: fn,144 value2: fn,145 },146 {147 deepEqual: false,148 description: 'function and different function are not equal',149 shallowEqual: false,150 value1: fn,151 value2: () => {},152 },153 ],154 },155 {156 description: 'objects',157 tests: [158 {159 deepEqual: true,160 description: 'empty objects are equal',161 shallowEqual: true,162 value1: {},163 value2: {},164 },165 {166 deepEqual: true,167 description: 'equal objects (same properties "order")',168 shallowEqual: true,169 value1: {170 a: 1,171 b: '2',172 },173 value2: {174 a: 1,175 b: '2',176 },177 },178 {179 deepEqual: true,180 description: 'equal objects (different properties "order")',181 shallowEqual: true,182 value1: {183 a: 1,184 b: '2',185 },186 value2: {187 a: 1,188 b: '2',189 },190 },191 {192 deepEqual: false,193 description: 'not equal objects (extra property)',194 shallowEqual: false,195 value1: {196 a: 1,197 b: '2',198 },199 value2: {200 a: 1,201 b: '2',202 c: [],203 },204 },205 {206 deepEqual: false,207 description: 'not equal objects (different properties)',208 shallowEqual: false,209 value1: {210 a: 1,211 b: '2',212 c: 3,213 },214 value2: {215 a: 1,216 b: '2',217 d: 3,218 },219 },220 {221 deepEqual: false,222 description: 'not equal objects (different properties)',223 shallowEqual: false,224 value1: {225 a: 1,226 b: '2',227 c: 3,228 },229 value2: {230 a: 1,231 b: '2',232 d: 3,233 },234 },235 {236 deepEqual: true,237 description: 'equal objects (same sub-properties)',238 shallowEqual: false,239 value1: { a: [{ b: 'c' }] },240 value2: { a: [{ b: 'c' }] },241 },242 {243 deepEqual: false,244 description: 'not equal objects (different sub-property value)',245 shallowEqual: false,246 value1: { a: [{ b: 'c' }] },247 value2: { a: [{ b: 'd' }] },248 },249 {250 deepEqual: false,251 description: 'not equal objects (different sub-property)',252 shallowEqual: false,253 value1: { a: [{ b: 'c' }] },254 value2: { a: [{ c: 'c' }] },255 },256 {257 deepEqual: false,258 description: 'empty array and empty object are not equal',259 shallowEqual: false,260 value1: {},261 value2: [],262 },263 {264 deepEqual: false,265 description: 'object with extra undefined properties are not equal #1',266 shallowEqual: false,267 value1: {},268 value2: { foo: undefined },269 },270 {271 deepEqual: false,272 description: 'object with extra undefined properties are not equal #2',273 shallowEqual: false,274 value1: { foo: undefined },275 value2: {},276 },277 {278 deepEqual: false,279 description: 'object with extra undefined properties are not equal #3',280 shallowEqual: false,281 value1: { foo: undefined },282 value2: { bar: undefined },283 },284 ],285 },286 {287 description: 'arrays',288 tests: [289 {290 deepEqual: true,291 description: 'two empty arrays are equal',292 shallowEqual: true,293 value1: [],294 value2: [],295 },296 {297 deepEqual: true,298 description: 'equal arrays',299 shallowEqual: true,300 value1: [1, 2, 3],301 value2: [1, 2, 3],302 },303 {304 deepEqual: false,305 description: 'not equal arrays (different item)',306 shallowEqual: false,307 value1: [1, 2, 3],308 value2: [1, 2, 4],309 },310 {311 deepEqual: false,312 description: 'not equal arrays (different length)',313 shallowEqual: false,314 value1: [1, 2, 3],315 value2: [1, 2],316 },317 {318 deepEqual: true,319 description: 'equal arrays of objects',320 shallowEqual: false,321 value1: [{ a: 'a' }, { b: 'b' }],322 value2: [{ a: 'a' }, { b: 'b' }],323 },324 {325 deepEqual: false,326 description: 'not equal arrays of objects',327 shallowEqual: false,328 value1: [{ a: 'a' }, { b: 'b' }],329 value2: [{ a: 'a' }, { b: 'c' }],330 },331 {332 deepEqual: false,333 description: 'pseudo array and equivalent array are not equal',334 shallowEqual: false,335 value1: {336 0: 0,337 1: 1,338 length: 2,339 },340 value2: [0, 1],341 },342 ],343 },344 {345 description: 'dates',346 tests: [347 {348 deepEqual: true,349 description: 'equal date objects',350 shallowEqual: true,351 value1: new Date('2017-06-16T21:36:48.362Z'),352 value2: new Date('2017-06-16T21:36:48.362Z'),353 },354 {355 deepEqual: false,356 description: 'not equal date objects',357 shallowEqual: false,358 value1: new Date('2017-06-16T21:36:48.362Z'),359 value2: new Date('2017-01-01T00:00:00.000Z'),360 },361 {362 deepEqual: false,363 description: 'date and string are not equal',364 shallowEqual: false,365 value1: new Date('2017-06-16T21:36:48.362Z'),366 value2: '2017-06-16T21:36:48.362Z',367 },368 {369 deepEqual: false,370 description: 'date and object are not equal',371 shallowEqual: false,372 value1: new Date('2017-06-16T21:36:48.362Z'),373 value2: {},374 },375 {376 deepEqual: true,377 description: 'invalid dates are equal',378 shallowEqual: true,379 value1: new Date('foo'),380 value2: new Date('bar'),381 },382 ],383 },384 {385 description: 'regexps',386 tests: [387 {388 deepEqual: true,389 description: 'equal RegExp objects',390 shallowEqual: true,391 value1: /foo/,392 value2: /foo/,393 },394 {395 deepEqual: false,396 description: 'not equal RegExp objects (different pattern)',397 shallowEqual: false,398 value1: /foo/,399 value2: /bar/,400 },401 {402 deepEqual: false,403 description: 'not equal RegExp objects (different flags)',404 shallowEqual: false,405 value1: /foo/g,406 value2: /foo/i,407 },408 {409 deepEqual: true,410 description: 'equal RegExp objects (different flags "order")',411 shallowEqual: true,412 value1: new RegExp('foo', 'gi'),413 value2: new RegExp('foo', 'ig'),414 },415 {416 deepEqual: false,417 description: 'RegExp and string are not equal',418 shallowEqual: false,419 value1: /foo/,420 value2: 'foo',421 },422 {423 deepEqual: false,424 description: 'RegExp and object are not equal',425 shallowEqual: false,426 value1: /foo/,427 value2: {},428 },429 ],430 },431 {432 description: 'maps',433 tests: [434 {435 deepEqual: true,436 description: 'equal Map objects',437 shallowEqual: true,438 value1: new Map().set('foo', 'bar'),439 value2: new Map().set('foo', 'bar'),440 },441 {442 deepEqual: false,443 description: 'not equal Map objects (different value)',444 shallowEqual: false,445 value1: new Map().set('foo', 'bar'),446 value2: new Map().set('foo', 'baz'),447 },448 {449 deepEqual: false,450 description: 'not equal Map objects (different key)',451 shallowEqual: false,452 value1: new Map().set('foo', 'bar'),453 value2: new Map().set('baz', 'bar'),454 },455 {456 deepEqual: false,457 description:458 'not equal Map objects (same keys / values, different pairings)',459 shallowEqual: false,460 value1: new Map().set('foo', 'bar'),461 value2: new Map().set('bar', 'foo'),462 },463 {464 deepEqual: true,465 description: 'deep equal Map objects',466 shallowEqual: false,467 value1: new Map().set('foo', new Map().set('bar', 'baz')),468 value2: new Map().set('foo', new Map().set('bar', 'baz')),469 },470 {471 deepEqual: false,472 description: 'Map and object are not equal',473 shallowEqual: false,474 value1: new Map().set('foo', 'bar'),475 value2: { foo: 'bar' },476 },477 {478 deepEqual: false,479 description: 'Map and Set are not equal',480 shallowEqual: false,481 value1: new Map().set('foo', 'foo'),482 value2: new Set().add('foo'),483 },484 ],485 },486 {487 description: 'sets',488 tests: [489 {490 deepEqual: true,491 description: 'equal Set objects',492 shallowEqual: true,493 value1: new Set().add('foo'),494 value2: new Set().add('foo'),495 },496 {497 deepEqual: false,498 description: 'not equal Set objects (different value)',499 shallowEqual: false,500 value1: new Set().add('foo'),501 value2: new Set().add('bar'),502 },503 {504 deepEqual: true,505 description: 'deep equal Set objects',506 shallowEqual: false,507 value1: new Set().add({ foo: 'bar' }),508 value2: new Set().add({ foo: 'bar' }),509 },510 {511 deepEqual: false,512 description: 'Set and array are not equal',513 shallowEqual: false,514 value1: new Set().add('foo'),515 value2: ['foo'],516 },517 ],518 },519 {520 description: 'promises',521 tests: [522 {523 deepEqual: true,524 description: 'promises are equal when strictly equal',525 shallowEqual: true,526 value1: promise,527 value2: promise,528 },529 {530 deepEqual: false,531 description: 'promises are not equal when not strictly equal',532 shallowEqual: false,533 value1: promise,534 value2: Promise.resolve('foo'),535 },536 ],537 },538 {539 description: 'react',540 tests: [541 {542 deepEqual: true,543 description: 'simple react elements are deeply equal',544 shallowEqual: false,545 value1: React.createElement('div', {}, 'foo'),546 value2: React.createElement('div', {}, 'foo'),547 },548 {549 deepEqual: false,550 description: 'simple react elements are not deeply equal',551 shallowEqual: false,552 value1: React.createElement('div', {}, 'foo'),553 value2: React.createElement('div', {}, 'bar'),554 },555 ],556 },557 {558 description: 'mixed objects equal',559 tests: [560 {561 deepEqual: true,562 description: 'big object',563 shallowEqual: false,564 value1: {565 prop1: 'value1',566 prop2: fn,567 prop3: null,568 prop4: {569 subProp1: 'sub value1',570 subProp2: {571 subSubProp1: 'sub sub value1',572 subSubProp2: [573 1,574 2,575 {576 prop: 2,577 prop2: 1,578 },579 4,580 5,581 ],582 },583 },584 prop5: 1000,585 prop6: new Date(2016, 2, 10),586 prop7: /foo/,587 },588 value2: {589 prop1: 'value1',590 prop2: fn,591 prop3: null,592 prop4: {593 subProp1: 'sub value1',594 subProp2: {595 subSubProp1: 'sub sub value1',596 subSubProp2: [597 1,598 2,599 {600 prop: 2,601 prop2: 1,602 },603 4,604 5,605 ],606 },607 },608 prop5: 1000,609 prop6: new Date(2016, 2, 10),610 prop7: /foo/,611 },612 },613 ],614 },615 {616 description: 'mixed objects not equal',617 tests: [618 {619 deepEqual: false,620 description: 'big object',621 shallowEqual: false,622 value1: {623 prop1: 'value1',624 prop2: fn,625 prop3: null,626 prop4: {627 subProp1: 'sub value1',628 subProp2: {629 subSubProp1: 'sub sub value1',630 subSubProp2: [631 1,632 2,633 {634 prop: 2,635 prop2: 1,636 },637 4,638 5,639 ],640 },641 },642 prop5: 1000,643 prop6: new Date(2016, 2, 10),644 prop7: /foo/,645 },646 value2: {647 prop1: 'value1',648 prop2: fn,649 prop3: null,650 prop4: {651 subProp1: 'sub value1',652 subProp2: {653 subSubProp1: 'sub sub value1',654 subSubProp2: [655 1,656 2,657 {658 prop: 2,659 prop2: 1,660 },661 4,662 5,663 ],664 },665 },666 prop5: 1000,667 prop6: new Date('2017/04/17'),668 prop7: /foo/,669 },670 },671 ],672 },...

Full Screen

Full Screen

shallowEqual.js

Source:shallowEqual.js Github

copy

Full Screen

1import test from 'ava';2import shallowEqual from '../src/shallowEqual'3test('string', t => {4 t.true(shallowEqual('abc','abc'));5 t.false(shallowEqual('abc','ab'));6});7test('number', t => {8 t.true(shallowEqual(100, 100));9 t.false(shallowEqual(12, 1));10});11test('all zero should be equal', t => {12 t.true(shallowEqual(-0, +0));13 t.true(shallowEqual(-0, 0));14 t.true(shallowEqual(+0, 0));15});16test('NaN', t => {17 t.true(shallowEqual(NaN, NaN));18 t.false(shallowEqual(NaN, 1));19});20test('null', t => {21 t.false(shallowEqual(null, {}));22 t.true(shallowEqual(null, null));23 t.false(shallowEqual(null, undefined));24});25test('undefined', t => {26 t.true(shallowEqual(undefined, undefined));27 t.false(shallowEqual(undefined, 0));28});29test('boolean', t => {30 t.true(shallowEqual(false, false));31 t.false(shallowEqual(false, true));32});33test('symbol', t => {34 t.true(shallowEqual(Symbol.for('test'), Symbol.for('test')));35 t.false(shallowEqual(Symbol('test'), Symbol('test')));36});37test('Date', t => {38 const a = new Date('2019-2-1');39 const b = new Date('2019-2-1');40 const c = new Date('2019-3-1');41 t.true(shallowEqual(a, b));42 t.false(shallowEqual(a, c));43});44test('RagExp', t => {45 const a = new RegExp('test');46 const b = new RegExp('test');47 t.true(shallowEqual(a, b));48 t.false(shallowEqual(a, /^test$/));49});50test('Set', t => {51 const a = new Set([1, 'da', null, {a: 'test', b: [1, 'a']}]);52 const b = new Set([1, 'da', null, {a: 'test', b: [1, 'a']}]);53 const c = new Set([1, 'da', null, {a: 'test', b: [1, 'b']}]);54 const d = new Set([1, 'da', null]);55 const e = new Set([1, 'da', null]);56 t.false(shallowEqual(a, b));57 t.false(shallowEqual(a, c));58 t.true(shallowEqual(d, e));59});60test('Map', t => {61 const a = new Map([[{a: 'b'}, {c: 'd'}],['test', null]]);62 const b = new Map([[{a: 'b'}, {c: 'd'}],['test', null]]);63 const c = new Map([[{a: 'e'}, {c: 'd'}],['test', null]]);64 const d = new Map([[{a: 'e'}, 123],['test', null]]);65 const e = new Map([[{a: 'e'}, 123],['test', null]]);66 const f = new Map([['a', 123],['test', null]]);67 const g = new Map([['a', 123],['test', null]]);68 const h = new Map([['a', 123]]);69 t.false(shallowEqual(a, b));70 t.false(shallowEqual(a, c));71 // Map 的键实际上是跟内存地址绑定的,只要内存地址不一样,就视为两个键。72 // 0和-0等,NaN和NaN等,===与Object.is的结合73 t.false(shallowEqual(d, e));74 t.true(shallowEqual(f, g));75 t.false(shallowEqual(g, h));76});77test('Array', t => {78 const a = ['a', 1, null, undefined, {a: 'b', b: {c: [1,2,3]}}, new Set(), new Map()];79 const b = ['a', 1, null, undefined, {a: 'b', b: {c: [1,2,3]}}, new Set(), new Map()];80 const c = ['a', 1, null, undefined, new Set(), new Map(), {a: 'b', b: {c: [1,2,3]}}];81 const d = ['a', 1, null, undefined, {a: 'b'}, new Set(), new Map()];82 const e = [1, 2, 'abc', true, undefined, null];83 const f = [1, 2, 'abc', true, undefined, null];84 t.false(shallowEqual(a, b));85 t.false(shallowEqual(a, c));86 t.false(shallowEqual(b, c));87 t.true(shallowEqual(e, f));88});89test('Function', t => {90 const a = () => {};91 const b = () => {};92 t.false(shallowEqual(a, b));93});94test('Object', t => {95 const a = {a: 'abc', b: {b1: 123}};96 const b = {a: 'abc', b: {b1: 123}};97 const c = {a: 'abc', b: 123};98 const d = {a: 'abc', b: 123};99 t.false(shallowEqual(a, b));100 t.false(shallowEqual(a, c));101 t.true(shallowEqual(c, d));102});103test('empty Object', t => {104 t.true(shallowEqual({}, {}));105});106test('empty Array', t => {107 t.true(shallowEqual([], []));...

Full Screen

Full Screen

test.js

Source:test.js Github

copy

Full Screen

...27var shallowEqual = sef;28// https://github.com/facebook/fbjs/blob/master/src/core/__tests__/shallowEqual-test.js29describe("shallowEqual", function() {30 it("returns false if either argument is null", function() {31 expect(shallowEqual(null, {})).to.be.false;32 expect(shallowEqual({}, null)).to.be.false;33 });34 it("returns true if both arguments are null or undefined", function() {35 expect(shallowEqual(null, null)).to.be.true;36 expect(shallowEqual(undefined, undefined)).to.be.true;37 });38 it("returns true if arguments are not objects and are equal", function() {39 expect(shallowEqual(1, 1)).to.be.true;40 });41 it("returns true if arguments are shallow equal", function() {42 expect(43 shallowEqual(44 {a: 1, b: 2, c: 3},45 {a: 1, b: 2, c: 3}46 )47 ).to.be.true;48 });49 it("returns true when comparing NaN", function() {50 expect(shallowEqual(NaN, NaN)).to.be.true;51 expect(52 shallowEqual(53 {a: 1, b: 2, c: 3, d: NaN},54 {a: 1, b: 2, c: 3, d: NaN}55 )56 ).to.be.true;57 });58 it("returns false if arguments are not objects and not equal", function() {59 expect(60 shallowEqual(61 1,62 263 )64 ).to.be.false;65 });66 it("returns false if only one argument is not an object", function() {67 expect(68 shallowEqual(69 1,70 {}71 )72 ).to.be.false;73 });74 it("returns false if first argument has too many keys", function() {75 expect(76 shallowEqual(77 {a: 1, b: 2, c: 3},78 {a: 1, b: 2}79 )80 ).to.be.false;81 });82 it("returns false if second argument has too many keys", function() {83 expect(84 shallowEqual(85 {a: 1, b: 2},86 {a: 1, b: 2, c: 3}87 )88 ).to.be.false;89 });90 // fuzzy effect91 it("returns true if arguments are not shallow equal", function() {92 expect(93 shallowEqual(94 {a: 1, b: 2, c: {}},95 {a: 1, b: 2, c: {}}96 )97 ).to.be.true;98 });...

Full Screen

Full Screen

test-utils.js

Source:test-utils.js Github

copy

Full Screen

...23});24describe('shallowEqual', function() {25 it('is true for same object', function() {26 const input = {foo: 1, bar: '2', baz: {}};27 expect(shallowEqual(input, input)).toBe(true);28 });29 it('is true for shallow equal objects', function() {30 const input = {foo: 1, bar: '2', baz: {}};31 expect(shallowEqual(input, {...input})).toBe(true);32 });33 it('is true for same arrays', function() {34 const input = [1, 'foo', {}];35 expect(shallowEqual(input, input)).toBe(true);36 });37 it('is true for shallow equal arrays', function() {38 const input = [1, 'foo', {}];39 expect(shallowEqual(input, [...input])).toBe(true);40 });41 it('is false for object and array', function() {42 expect(43 shallowEqual([1, 'foo', {}], {foo: 1, bar: '2', baz: {}})44 ).toBe(false);45 });46 it('is false for different length arrays', function() {47 expect(shallowEqual([1, 2], [1, 2, 3])).toBe(false);48 });49 it('is false for objects with non matching keys', function() {50 expect(shallowEqual({foo: 1, bar: 2}, {foo: 1, baz: 3})).toBe(false);51 });52 it('is false for object and null', function() {53 expect(54 shallowEqual(null, {foo: 1, bar: '2', baz: {}})55 ).toBe(false);56 });57 it('is true for equal primitives', function() {58 expect(shallowEqual(1, 1)).toBe(true);59 expect(shallowEqual(true, true)).toBe(true);60 expect(shallowEqual(null, null)).toBe(true);61 expect(shallowEqual('foo', 'foo')).toBe(true);62 });63 it('is false for different primitives', function() {64 expect(shallowEqual(1, 2)).toBe(false);65 expect(shallowEqual(true, false)).toBe(false);66 expect(shallowEqual(null, undefined)).toBe(false);67 expect(shallowEqual('foo', 'bar')).toBe(false);68 });...

Full Screen

Full Screen

shallowEqual.spec.js

Source:shallowEqual.spec.js Github

copy

Full Screen

2describe('Utils', () => {3 describe('shallowEqual', () => {4 it('should return true if arguments fields are equal', () => {5 expect(6 shallowEqual({ a: 1, b: 2, c: undefined }, { a: 1, b: 2, c: undefined })7 ).toBe(true)8 expect(shallowEqual({ a: 1, b: 2, c: 3 }, { a: 1, b: 2, c: 3 })).toBe(9 true10 )11 const o = {}12 expect(shallowEqual({ a: 1, b: 2, c: o }, { a: 1, b: 2, c: o })).toBe(13 true14 )15 const d = function () {16 return 117 }18 expect(19 shallowEqual({ a: 1, b: 2, c: o, d }, { a: 1, b: 2, c: o, d })20 ).toBe(true)21 })22 it('should return false if arguments fields are different function identities', () => {23 expect(24 shallowEqual(25 {26 a: 1,27 b: 2,28 d: function () {29 return 130 },31 },32 {33 a: 1,34 b: 2,35 d: function () {36 return 137 },38 }39 )40 ).toBe(false)41 })42 it('should return false if first argument has too many keys', () => {43 expect(shallowEqual({ a: 1, b: 2, c: 3 }, { a: 1, b: 2 })).toBe(false)44 })45 it('should return false if second argument has too many keys', () => {46 expect(shallowEqual({ a: 1, b: 2 }, { a: 1, b: 2, c: 3 })).toBe(false)47 })48 it('should return false if arguments have different keys', () => {49 expect(50 shallowEqual(51 { a: 1, b: 2, c: undefined },52 { a: 1, bb: 2, c: undefined }53 )54 ).toBe(false)55 })56 it('should compare two NaN values', () => {57 expect(shallowEqual(NaN, NaN)).toBe(true)58 })59 it('should compare empty objects, with false', () => {60 expect(shallowEqual({}, false)).toBe(false)61 expect(shallowEqual(false, {})).toBe(false)62 expect(shallowEqual([], false)).toBe(false)63 expect(shallowEqual(false, [])).toBe(false)64 })65 it('should compare two zero values', () => {66 expect(shallowEqual(0, 0)).toBe(true)67 })68 })...

Full Screen

Full Screen

shallowEqual.test.js

Source:shallowEqual.test.js Github

copy

Full Screen

...5 get foo() {6 throw new Error('Property was accessed');7 },8 };9 expect(shallowEqual(throwOnAccess, throwOnAccess)).toBe(true);10});11test('shallowEqual returns true if arguments fields are equal', () => {12 expect(shallowEqual({ a: 1, b: 2, c: undefined }, { a: 1, b: 2, c: undefined })).toBe(true);13 expect(shallowEqual({ a: 1, b: 2, c: 3 }, { a: 1, b: 2, c: 3 })).toBe(true);14 const o = {};15 expect(shallowEqual({ a: 1, b: 2, c: o }, { a: 1, b: 2, c: o })).toBe(true);16});17test('shallowEqual returns false if either argument is null or undefined', () => {18 expect(shallowEqual(null, { a: 1, b: 2 })).toBe(false);19 expect(shallowEqual({ a: 1, b: 2 }, null)).toBe(false);20});21test('shallowEqual returns false if first argument has too many keys', () => {22 expect(shallowEqual({ a: 1, b: 2, c: 3 }, { a: 1, b: 2 })).toBe(false);23});24test('shallowEqual returns false if second argument has too many keys', () => {25 expect(shallowEqual({ a: 1, b: 2 }, { a: 1, b: 2, c: 3 })).toBe(false);26});27test('shallowEqual returns false if arguments have different keys', () => {28 expect(shallowEqual({ a: 1, b: 2, c: undefined }, { a: 1, bb: 2, c: undefined })).toBe(false);...

Full Screen

Full Screen

objects_tests.js

Source:objects_tests.js Github

copy

Full Screen

2import { shallowEqual } from "@web/core/utils/objects";3QUnit.module("utils", () => {4 QUnit.module("Objects");5 QUnit.test("shallowEqual: simple valid cases", function (assert) {6 assert.ok(shallowEqual({}, {}));7 assert.ok(shallowEqual({ a: 1 }, { a: 1 }));8 assert.ok(shallowEqual({ a: 1, b: "x" }, { b: "x", a: 1 }));9 });10 QUnit.test("shallowEqual: simple invalid cases", function (assert) {11 assert.notOk(shallowEqual({ a: 1 }, { a: 2 }));12 assert.notOk(shallowEqual({}, { a: 2 }));13 assert.notOk(shallowEqual({ a: 1 }, {}));14 });15 QUnit.test("shallowEqual: objects with non primitive values", function (assert) {16 const obj = { x: "y" };17 assert.ok(shallowEqual({ a: obj }, { a: obj }));18 assert.notOk(shallowEqual({ a: { x: "y" } }, { a: { x: "y" } }));19 const arr = ["x", "y", "z"];20 assert.ok(shallowEqual({ a: arr }, { a: arr }));21 assert.notOk(shallowEqual({ a: ["x", "y", "z"] }, { a: ["x", "y", "z"] }));22 const fn = () => {};23 assert.ok(shallowEqual({ a: fn }, { a: fn }));24 assert.notOk(shallowEqual({ a: () => {} }, { a: () => {} }));25 });...

Full Screen

Full Screen

Using AI Code Generation

copy

Full Screen

1const { shallowEqual } = require('playwright/lib/utils/shallowEqual');2const { deepEqual } = require('playwright/lib/utils/deepEqual');3const { deepStrictEqual } = require('playwright/lib/utils/deepStrictEqual');4const { isDeepStrictEqual } = require('playwright/lib/utils/isDeepStrictEqual');5const { isDeepStrictEqual } = require('playwright/lib/utils/isDeepStrictEqual');6const { isDeepEqual } = require('playwright/lib/utils/isDeepEqual');7const { isEmpty } = require('playwright/lib/utils/isEmpty');8const { isRegExp } = require('playwright/lib/utils/isRegExp');9const { isString } = require('playwright/lib/utils/isString');10const { isNumber } = require('playwright/lib/utils/isNumber');11const { isBoolean } = require('playwright/lib/utils/isBoolean');12const { isObject } = require('playwright/lib/utils/isObject');13const { isFunction } = require('playwright/lib/utils/isFunction');14const { isDate } = require('playwright/lib/utils/isDate');15const { isNull } = require('playwright/lib/utils/isNull');16const { isUndefined } = require('playwright/lib/utils/isUndefined');17const { isNullOrUndefined } = require('playwright/lib/utils/isNullOrUndefined');18const { isStringOrRegExp } = require('playwright/lib/utils/isStringOrRegExp');

Full Screen

Using AI Code Generation

copy

Full Screen

1const {chromium} = require('playwright');2const {shallowEqual} = require('playwright/lib/server/supplements/recorder/recorderSupplement');3(async () => {4 const browser = await chromium.launch();5 const context = await browser.newContext();6 const page = await context.newPage();7 const searchInput = await page.$('.navbar__search-input');8 const searchInput2 = await page.$('.navbar__search-input');9 console.log(shallowEqual(searchInput, searchInput2));10 await browser.close();11})();

Full Screen

Using AI Code Generation

copy

Full Screen

1const { shallowEqual } = require('@playwright/test/lib/utils/utils');2const { isDeepEqual } = require('@playwright/test/lib/utils/utils');3const { isDeepStrictEqual } = require('@playwright/test/lib/utils/utils');4const { isDeepStrictEqual } = require('@playwright/test/lib/utils/utils');5const a = { a: 1, b: 2 };6const b = { a: 1, b: 2 };7const c = { a: 1, b: 3 };8console.log("shallowEqual(a, b) : ", shallowEqual(a, b));9console.log("shallowEqual(a, c) : ", shallowEqual(a, c));10console.log("isDeepEqual(a, b) : ", isDeepEqual(a, b));11console.log("isDeepEqual(a, c) : ", isDeepEqual(a, c));12console.log("isDeepStrictEqual(a, b) : ", isDeepStrictEqual(a, b));13console.log("isDeepStrictEqual(a, c) : ", isDeepStrictEqual(a, c));14shallowEqual(a, b) : true15shallowEqual(a, c) : false16isDeepEqual(a, b) : true17isDeepEqual(a, c) : false18isDeepStrictEqual(a, b) : true19isDeepStrictEqual(a, c) : false

Full Screen

Using AI Code Generation

copy

Full Screen

1const { internal } = require("playwright");2const shallowEqual = internal.shallowEqual;3const a = { a: "a" };4const b = { a: "a" };5console.log(shallowEqual(a, b));6const { internal } = require("playwright");7const deepEqual = internal.deepEqual;8const a = { a: "a" };9const b = { a: "a" };10console.log(deepEqual(a, b));11const { internal } = require("playwright");12const deepStrictEqual = internal.deepStrictEqual;13const a = { a: "a" };14const b = { a: "a" };15console.log(deepStrictEqual(a, b));16const { internal } = require("playwright");17const isUnderTest = internal.isUnderTest();18console.log(isUnderTest);19const { internal } = require("playwright");20const setUnderTest = internal.setUnderTest();21console.log(setUnderTest);22const { internal } = require("playwright");23const setUnderTest = internal.setUnderTest();24console.log(setUnderTest);25const { internal } = require("playwright");26const setUnderTest = internal.setUnderTest();27console.log(setUnderTest);28const { internal } = require("playwright");29const setUnderTest = internal.setUnderTest();30console.log(setUnderTest);31const { internal } = require("playwright");32const setUnderTest = internal.setUnderTest();33console.log(setUnderTest);34const { internal } = require("playwright");35const setUnderTest = internal.setUnderTest();36console.log(setUnderTest);37const { internal } = require("playwright");38const setUnderTest = internal.setUnderTest();39console.log(setUnderTest);

Full Screen

Using AI Code Generation

copy

Full Screen

1const { shallowEqual } = require('@playwright/test/lib/utils/utils').utils;2const { deepEqual } = require('@playwright/test/lib/utils/utils').utils;3const { deepStrictEqual } = require('@playwright/test/lib/utils/utils').utils;4const { strictEqual } = require('@playwright/test/lib/utils/utils').utils;5const { equal } = require('@playwright/test/lib/utils/utils').utils;6const { strictEqual } = require('@playwright/test/lib/utils/utils').utils;7const { equal } = require('@playwright/test/lib/utils/utils').utils;8const { strictEqual } = require('@playwright/test/lib/utils/utils').utils;9const { equal } = require('@playwright/test/lib/utils/utils').utils;10const { strictEqual } = require('@playwright/test/lib/utils/utils').utils;11const { equal } = require('@playwright/test/lib/utils/utils').utils;12const { strictEqual } = require('@playwright/test/lib/utils/utils').utils;13const { equal } = require('@playwright/test/lib/utils/utils').utils;14const { strictEqual } = require('@playwright/test/lib/utils/utils').utils;15const { equal } = require('@playwright/test/lib/utils/utils').utils;16const { strictEqual } = require('@playwright/test/lib/utils/utils').utils;17const { equal } = require('@playwright/test/lib/utils/utils').utils;18const { strictEqual } = require('@playwright/test/lib/utils/utils').utils;

Full Screen

Using AI Code Generation

copy

Full Screen

1const { shallowEqual } = require('playwright/lib/internal/utils');2const a = { a: 'a' };3const b = { b: 'b' };4const c = { a: 'a' };5shallowEqual(a, b)6const { shallowEqual } = require('playwright/lib/internal/utils');7const a = { a: 'a' };8const b = { b: 'b' };9const c = { a: 'a' };10shallowObjectEntries(a)11const { shallowObjectEntries } = require('playwright/lib/internal/utils');12const a = { a: 'a', b: 'b' };13shallowObjectFromEntries(entries)14const { shallowObjectFromEntries } = require('playwright/lib/internal/utils');15const entries = [ [ 'a', 'a' ], [ 'b', 'b' ] ];16shallowObjectValues(a)17const { shallowObjectValues } = require('playwright/lib/internal/utils');18const a = { a: 'a', b: 'b' };

Full Screen

Playwright tutorial

LambdaTest’s Playwright tutorial will give you a broader idea about the Playwright automation framework, its unique features, and use cases with examples to exceed your understanding of Playwright testing. This tutorial will give A to Z guidance, from installing the Playwright framework to some best practices and advanced concepts.

Chapters:

  1. What is Playwright : Playwright is comparatively new but has gained good popularity. Get to know some history of the Playwright with some interesting facts connected with it.
  2. How To Install Playwright : Learn in detail about what basic configuration and dependencies are required for installing Playwright and run a test. Get a step-by-step direction for installing the Playwright automation framework.
  3. Playwright Futuristic Features: Launched in 2020, Playwright gained huge popularity quickly because of some obliging features such as Playwright Test Generator and Inspector, Playwright Reporter, Playwright auto-waiting mechanism and etc. Read up on those features to master Playwright testing.
  4. What is Component Testing: Component testing in Playwright is a unique feature that allows a tester to test a single component of a web application without integrating them with other elements. Learn how to perform Component testing on the Playwright automation framework.
  5. Inputs And Buttons In Playwright: Every website has Input boxes and buttons; learn about testing inputs and buttons with different scenarios and examples.
  6. Functions and Selectors in Playwright: Learn how to launch the Chromium browser with Playwright. Also, gain a better understanding of some important functions like “BrowserContext,” which allows you to run multiple browser sessions, and “newPage” which interacts with a page.
  7. Handling Alerts and Dropdowns in Playwright : Playwright interact with different types of alerts and pop-ups, such as simple, confirmation, and prompt, and different types of dropdowns, such as single selector and multi-selector get your hands-on with handling alerts and dropdown in Playright testing.
  8. Playwright vs Puppeteer: Get to know about the difference between two testing frameworks and how they are different than one another, which browsers they support, and what features they provide.
  9. Run Playwright Tests on LambdaTest: Playwright testing with LambdaTest leverages test performance to the utmost. You can run multiple Playwright tests in Parallel with the LammbdaTest test cloud. Get a step-by-step guide to run your Playwright test on the LambdaTest platform.
  10. Playwright Python Tutorial: Playwright automation framework support all major languages such as Python, JavaScript, TypeScript, .NET and etc. However, there are various advantages to Python end-to-end testing with Playwright because of its versatile utility. Get the hang of Playwright python testing with this chapter.
  11. Playwright End To End Testing Tutorial: Get your hands on with Playwright end-to-end testing and learn to use some exciting features such as TraceViewer, Debugging, Networking, Component testing, Visual testing, and many more.
  12. Playwright Video Tutorial: Watch the video tutorials on Playwright testing from experts and get a consecutive in-depth explanation of Playwright automation testing.

Run Playwright Internal automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful