typia
Version:
Superfast runtime validators with only one line
1 lines • 1.53 kB
Source Map (JSON)
{"version":3,"file":"_notationPascal.mjs","names":[],"sources":["../../src/internal/_notationPascal.ts"],"sourcesContent":["import { __notationRename } from \"./private/__notationRename\";\n\nconst _notationPascalSnake = (str: string): string => {\n while (str.startsWith(\"_\")) str = str.substring(1);\n if (str.length === 0) return \"\";\n const index: number = str.indexOf(\"_\");\n return index < 0\n ? `${str[0]!.toUpperCase()}${str.substring(1).toLowerCase()}`\n : `${str[0]!.toUpperCase()}${str\n .substring(1, index)\n .toLowerCase()}${_notationPascalSnake(str.substring(index + 1))}`;\n};\n\nexport const _notationPascal = __notationRename({\n // `PascalCase<T>` capitalizes the first character of an underscore-free key\n // and keeps the rest verbatim (`userID` -> `UserID`).\n plain: (str) => `${str[0]!.toUpperCase()}${str.substring(1)}`,\n // With an underscore present, each segment is capitalized and its tail is\n // lowercased (`MAX_COUNT` -> `MaxCount`), matching `PascalizeSnakeString`.\n snake: _notationPascalSnake,\n});\n"],"mappings":";;AAEA,MAAM,wBAAwB,QAAwB;CACpD,OAAO,IAAI,WAAW,GAAG,GAAG,MAAM,IAAI,UAAU,CAAC;CACjD,IAAI,IAAI,WAAW,GAAG,OAAO;CAC7B,MAAM,QAAgB,IAAI,QAAQ,GAAG;CACrC,OAAO,QAAQ,IACX,GAAG,IAAI,EAAE,CAAE,YAAY,IAAI,IAAI,UAAU,CAAC,CAAC,CAAC,YAAY,MACxD,GAAG,IAAI,EAAE,CAAE,YAAY,IAAI,IACxB,UAAU,GAAG,KAAK,CAAC,CACnB,YAAY,IAAI,qBAAqB,IAAI,UAAU,QAAQ,CAAC,CAAC;AACtE;AAEA,MAAa,kBAAkB,iBAAiB;CAG9C,QAAQ,QAAQ,GAAG,IAAI,EAAE,CAAE,YAAY,IAAI,IAAI,UAAU,CAAC;CAG1D,OAAO;AACT,CAAC"}