summaryrefslogtreecommitdiff
path: root/includes/serverinfo/node_modules/@babel/types/lib/validators/isType.js.map
blob: 85923abe9f184c0bf56c685350af476af51c4dfa (plain)
1
{"version":3,"names":["isType","nodeType","targetType","ALIAS_KEYS","aliases","FLIPPED_ALIAS_KEYS","alias"],"sources":["../../src/validators/isType.ts"],"sourcesContent":["import { FLIPPED_ALIAS_KEYS, ALIAS_KEYS } from \"../definitions\";\nimport type * as t from \"..\";\n\nexport default function isType<T extends t.Node[\"type\"]>(\n  nodeType: string,\n  targetType: T,\n): nodeType is T;\n\nexport default function isType(\n  nodeType: string | null | undefined,\n  targetType: string,\n): boolean;\n\n/**\n * Test if a `nodeType` is a `targetType` or if `targetType` is an alias of `nodeType`.\n */\nexport default function isType(nodeType: string, targetType: string): boolean {\n  if (nodeType === targetType) return true;\n\n  // This is a fast-path. If the test above failed, but an alias key is found, then the\n  // targetType was a primary node type, so there's no need to check the aliases.\n  // @ts-expect-error targetType may not index ALIAS_KEYS\n  if (ALIAS_KEYS[targetType]) return false;\n\n  const aliases: Array<string> | undefined = FLIPPED_ALIAS_KEYS[targetType];\n  if (aliases) {\n    if (aliases[0] === nodeType) return true;\n\n    for (const alias of aliases) {\n      if (nodeType === alias) return true;\n    }\n  }\n\n  return false;\n}\n"],"mappings":";;;;;;;AAAA;;AAgBe,SAASA,MAAT,CAAgBC,QAAhB,EAAkCC,UAAlC,EAA+D;EAC5E,IAAID,QAAQ,KAAKC,UAAjB,EAA6B,OAAO,IAAP;EAK7B,IAAIC,uBAAA,CAAWD,UAAX,CAAJ,EAA4B,OAAO,KAAP;EAE5B,MAAME,OAAkC,GAAGC,+BAAA,CAAmBH,UAAnB,CAA3C;;EACA,IAAIE,OAAJ,EAAa;IACX,IAAIA,OAAO,CAAC,CAAD,CAAP,KAAeH,QAAnB,EAA6B,OAAO,IAAP;;IAE7B,KAAK,MAAMK,KAAX,IAAoBF,OAApB,EAA6B;MAC3B,IAAIH,QAAQ,KAAKK,KAAjB,EAAwB,OAAO,IAAP;IACzB;EACF;;EAED,OAAO,KAAP;AACD"}