@prismicio/mock
Version:
Generate mock Prismic documents, fields, Slices, and models for development and testing environments
1 lines • 1.08 kB
Source Map (JSON)
{"version":3,"file":"changeCase.cjs","names":[],"sources":["../../src/lib/changeCase.ts"],"sourcesContent":["export const capitalCase = (input: string): string =>\n\tstripPunctuation(input).replace(/(^\\w|\\s\\w)/g, (char) => char.toUpperCase())\n\nexport const snakeCase = (input: string): string =>\n\tstripPunctuation(input).toLowerCase().replace(/\\s/g, \"_\")\n\nexport const sentenceCase = (input: string): string =>\n\tstripPunctuation(input).replace(/^./, (char) => char.toUpperCase())\n\nexport const pascalCase = (input: string): string =>\n\tcapitalCase(stripPunctuation(input.replace(/-|_/, \" \"))).replace(/ /g, \"\")\n\nconst stripPunctuation = (input: string) => input.replace(/[^\\p{L}\\p{N}\\s]/gu, \"\")\n"],"mappings":";AAAA,MAAa,eAAe,UAC3B,iBAAiB,MAAM,CAAC,QAAQ,gBAAgB,SAAS,KAAK,aAAa,CAAC;AAE7E,MAAa,aAAa,UACzB,iBAAiB,MAAM,CAAC,aAAa,CAAC,QAAQ,OAAO,IAAI;AAE1D,MAAa,gBAAgB,UAC5B,iBAAiB,MAAM,CAAC,QAAQ,OAAO,SAAS,KAAK,aAAa,CAAC;AAEpE,MAAa,cAAc,UAC1B,YAAY,iBAAiB,MAAM,QAAQ,OAAO,IAAI,CAAC,CAAC,CAAC,QAAQ,MAAM,GAAG;AAE3E,MAAM,oBAAoB,UAAkB,MAAM,QAAQ,qBAAqB,GAAG"}