MCPcopy Index your code
hub / github.com/nodejs/nodejs.org / dashToCamelCase

Function dashToCamelCase

apps/site/util/string.ts:4–9  ·  view source on GitHub ↗
(str: string)

Source from the content-addressed store, hash-verified

2 [...(str.trim().match(/\b(\w)/g) || '')].join('').toUpperCase();
3
4export const dashToCamelCase = (str: string) =>
5 str
6 .replace(/-([a-z])/g, (match, chr) => chr.toUpperCase())
7 // remove leftover - which don't match the above regex. Like 'es-2015'
8 .replace(/-/g, '')
9 .replace(/^[A-Z]/, chr => chr.toLowerCase());

Callers 1

string.test.mjsFile · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected