UNPKG

@stryke/prisma-trpc-generator

Version:

A fork of the prisma-trpc-generator code to work in ESM with Prisma v6.

14 lines (12 loc) 419 B
//#region ../string-format/src/decamelize.ts /** * Convert a camelCase or PascalCase string to a snake_case string. * * @param value - The camelCase or PascalCase string to convert. * @returns The converted snake_case string. */ function decamelize(value) { return value.replace(/([a-z\d])([A-Z])/g, "$1_$2").replace(/([A-Z]+)([A-Z][a-z\d]+)/g, "$1_$2").toLowerCase(); } //#endregion exports.decamelize = decamelize;