{"version":3,"file":"__notationRename.mjs","names":[],"sources":["../../../src/internal/private/__notationRename.ts"],"sourcesContent":["/**\n * Shared outer walk for the `camel`/`pascal` notations.\n *\n * Mirrors the `CamelCase<T>` / `PascalCase<T>` typings: leading underscores are\n * preserved verbatim, an all-underscore key stays untouched, and the presence\n * of any remaining underscore — not the number of non-empty segments — selects\n * the `snake` conversion. Routing on underscore presence keeps a trailing or\n * doubled underscore (`fooBar_`) on the same path the type takes, instead of\n * collapsing it to the underscore-free `plain` path.\n *\n * @evidence contracts/common.md#principled-implementation Leading underscores are kept, an all-underscore key is returned as is and the presence of an underscore in the rest selects the snake conversion, which keeps a trailing or doubled underscore on the path the CamelCase and PascalCase typings take.\n * @evidence contracts/common.md#clear-and-simple-design One curried function parameterized by the two strategies that the camel and pascal notations supply.\n * @evidence contracts/common.md#prohibited-implementation-shortcuts The routing rule is the typings' own.\n * @evidence contracts/common.md#meaningful-documentation The doc states the routing rule and why it uses underscore presence.\n */\nexport const __notationRename =\n  (props: { plain: (str: string) => string; snake: (str: string) => string }) =>\n  (str: string): string => {\n    let prefix: string = \"\";\n    while (str.startsWith(\"_\")) {\n      prefix += \"_\";\n      str = str.substring(1);\n    }\n    if (str.length === 0) return prefix;\n    return `${prefix}${str.includes(\"_\") ? props.snake(str) : props.plain(str)}`;\n  };\n"],"mappings":";;;;;;;;;;;;;;;;AAeA,MAAa,oBACV,WACA,QAAwB;CACvB,IAAI,SAAiB;CACrB,OAAO,IAAI,WAAW,GAAG,GAAG;EAC1B,UAAU;EACV,MAAM,IAAI,UAAU,CAAC;CACvB;CACA,IAAI,IAAI,WAAW,GAAG,OAAO;CAC7B,OAAO,GAAG,SAAS,IAAI,SAAS,GAAG,IAAI,MAAM,MAAM,GAAG,IAAI,MAAM,MAAM,GAAG;AAC3E"}