@ptenn/formatting
v0.0.0
Published
## Installation
Downloads
2
Readme
@ptenn/formatting
Installation
yarn add @ptenn/formatting
Usage
Email Formatting
import { normalizeEmail } from '@ptenn/formatting';
const formatted = normalizeEmail('[email protected]');
console.log(formatted); // [email protected]
Object Formatting
import { camelizeKeys, modifiedSnakeCase, snakeifyKeys } from '@ptenn/formatting';
const toCamelized = camelizeKeys({
first_value: 'data',
});
console.log(Object.keys(toCamelized)); // [ 'firstValue' ]
const toModifiedSnakeCase = modifiedSnakeCase('simpleString');
console.log(toModifiedSnakeCase); // simple_test
const toSnakeifyKeys = snakeifyKeys({
firstValue: 'data',
});
console.log(Object.keys(toSnakeifyKeys)); // [ 'first_value' ]