@stryke/prisma-trpc-generator
Version:
A fork of the prisma-trpc-generator code to work in ESM with Prisma v6.
1 lines • 1.42 kB
Source Map (JSON)
{"version":3,"file":"decamelize.mjs","names":[],"sources":["../../../../string-format/src/decamelize.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Stryke\n\n This code was released as part of the Stryke project. Stryke\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/stryke.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/stryke\n Documentation: https://docs.stormsoftware.com/projects/stryke\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\n/**\n * Convert a camelCase or PascalCase string to a snake_case string.\n *\n * @param value - The camelCase or PascalCase string to convert.\n * @returns The converted snake_case string.\n */\nexport function decamelize(value: string): string {\n return value\n .replace(/([a-z\\d])([A-Z])/g, \"$1_$2\")\n .replace(/([A-Z]+)([A-Z][a-z\\d]+)/g, \"$1_$2\")\n .toLowerCase();\n}\n"],"mappings":";;;;;;;AAwBA,SAAgB,WAAW,OAAuB;AAChD,QAAO,MACJ,QAAQ,qBAAqB,QAAQ,CACrC,QAAQ,4BAA4B,QAAQ,CAC5C,aAAa"}