import lowerCase from "./lowerCase.ts";
import nonWordRegexp from "./vendor/nonWordRegexp.ts";import camelCaseRegexp from "./vendor/camelCaseRegexp.ts";import camelCaseUpperRegexp from "./vendor/camelCaseUpperRegexp.ts";
export default function normalCase( str: string, locale?: string, replacement?: string,): string { if (str == null) { return ""; }
replacement = typeof replacement !== "string" ? " " : replacement;
function replace(match: string, index: number, value: string): string { if (index === 0 || index === value.length - match.length) { return ""; }
return replacement!; }
str = String(str) .replace(camelCaseRegexp, "$1 $2") .replace(camelCaseUpperRegexp, "$1 $2") .replace(nonWordRegexp, replace);
return lowerCase(str, locale);}