Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function normalizeKeyName (options, name) {
if (options.normalizeNames) {
let newName = noCase(name.replace('\'', ''), null, '_')
const diacMatch = newName.match(lazyDiacriticsRegex)
// Replace diacritics with their ascii equivalent (e.g ö -> o)
if (diacMatch && lazyDiacriticsMap[diacMatch[1]]) {
newName = newName.replace(diacMatch[1], lazyDiacriticsMap[diacMatch[1]])
}
if (options.normalizeNamesAs === 'camel') {
return camelCase(newName)
}
return newName
}
return name
}
export function constantCase(input: string, options: Options = {}) {
return noCase(input, {
delimiter: "_",
transform: upperCase,
...options
});
}
export function pascalCase(input: string, options: Options = {}) {
return noCase(input, {
delimiter: "",
transform: pascalCaseTransform,
...options
});
}
export function capitalCase(input: string, options: Options = {}) {
return noCase(input, {
delimiter: " ",
transform: capitalCaseTransform,
...options
});
}