swc/bundler/tests/.cache/deno/fee2452e02044e29c1091ffcbc1987bfc1f26590.ts
강동윤 bbaf619f63
fix(bundler): Fix bugs (#1437)
swc_bundler:
 - [x] Fix wrapped esms. (denoland/deno#9307)
 - [x] Make test secure.
2021-03-02 17:33:03 +09:00

24 lines
620 B
TypeScript

// Loaded from https://deno.land/x/case@v2.1.0/camelCase.ts
import upperCase from "./upperCase.ts";
import normalCase from "./normalCase.ts";
export default function camelCase(
value: string,
locale?: string,
mergeNumbers?: boolean,
): string {
let result = normalCase(value, locale);
// Replace periods between numeric entities with an underscore.
if (!mergeNumbers) {
result = result.replace(/ (?=\d)/g, "_");
}
// Replace spaces between words with an upper cased character.
return result.replace(/ (.)/g, function (m: string, $1: string): string {
return upperCase($1, locale);
});
}