Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
});
humps.decamelizeKeys(someObject, function (key, convert, options) {
return /^[A-Z0-9_]+$/.test(key) ? key : convert(key, options);
});
humps.camelize('hello_world-foo bar');
humps.pascalize('hello_world-foo bar');
humps.decamelize('helloWorldFooBar');
humps.decamelize('helloWorldFooBar', someOptions);
humps.decamelize('helloWorld1', { split: /(?=[A-Z0-9])/ })
humps.depascalize('helloWorldFooBar');
humps.camelizeKeys(someObject);
humps.pascalizeKeys(someObject);
humps.decamelizeKeys(someObject);
humps.depascalizeKeys(someObject);
humps.camelizeKeys(someObject, someOptions);
humps.pascalizeKeys(someObject, someOptions);
humps.decamelizeKeys(someObject, someOptions);
humps.depascalizeKeys(someObject, someOptions);
humps.camelizeKeys(someObject, someOptions2);
humps.pascalizeKeys(someObject, someOptions2);
humps.decamelizeKeys(someObject, someOptions2);
humps.depascalizeKeys(someObject, someOptions2);
const types = ['default', 'snake', 'pascal', 'camel', 'dashes'];
if (types.indexOf(casing) === -1) {
throw new Error(`Casing must be one of: ${types.join(', ')} types`);
}
if (casing === 'snake') {
return depascalize(pascalize(string));
} else if (casing === 'pascal') {
return pascalize(string);
} else if (casing === 'camel') {
return camelize(string);
} else if (casing === 'default') {
return string;
} else if (casing == 'dashes') {
return depascalize(string, { separator: '-' });
}
};
export const normalizeCasing = (string, casing) => {
const types = ['default', 'snake', 'pascal', 'camel', 'dashes'];
if (types.indexOf(casing) === -1) {
throw new Error(`Casing must be one of: ${types.join(', ')} types`);
}
if (casing === 'snake') {
return depascalize(pascalize(string));
} else if (casing === 'pascal') {
return pascalize(string);
} else if (casing === 'camel') {
return camelize(string);
} else if (casing === 'default') {
return string;
} else if (casing == 'dashes') {
return depascalize(string, { separator: '-' });
}
};