UNPKG

typia

Version:

Superfast runtime validators with only one line

1 lines 1.41 kB
{"version":3,"file":"_accessExpressionAsString.mjs","names":[],"sources":["../../src/internal/_accessExpressionAsString.ts"],"sourcesContent":["export const _accessExpressionAsString = (str: string): string =>\n variable(str) ? `.${str}` : `[${JSON.stringify(str)}]`;\n\nconst variable = (str: string): boolean =>\n reserved(str) === false && /^[a-zA-Z_$][a-zA-Z_$0-9]*$/g.test(str);\n\nconst reserved = (str: string): boolean => RESERVED.has(str);\n\nconst RESERVED: Set<string> = new Set([\n \"break\",\n \"case\",\n \"catch\",\n \"class\",\n \"const\",\n \"continue\",\n \"debugger\",\n \"default\",\n \"delete\",\n \"do\",\n \"else\",\n \"enum\",\n \"export\",\n \"extends\",\n \"false\",\n \"finally\",\n \"for\",\n \"function\",\n \"if\",\n \"import\",\n \"in\",\n \"instanceof\",\n \"new\",\n \"null\",\n \"return\",\n \"super\",\n \"switch\",\n \"this\",\n \"throw\",\n \"true\",\n \"try\",\n \"typeof\",\n \"var\",\n \"void\",\n \"while\",\n \"with\",\n]);\n"],"mappings":";AAAA,MAAa,6BAA6B,QACxC,SAAS,GAAG,IAAI,IAAI,QAAQ,IAAI,KAAK,UAAU,GAAG,EAAE;AAEtD,MAAM,YAAY,QAChB,SAAS,GAAG,MAAM,SAAS,8BAA8B,KAAK,GAAG;AAEnE,MAAM,YAAY,QAAyB,SAAS,IAAI,GAAG;AAE3D,MAAM,2BAAwB,IAAI,IAAI;CACpC;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACF,CAAC"}