Package Exports
- keys-transform
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (keys-transform) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
Keys Transform
Features
- Recursive Object Keys Transformation to Lower, Upper, Camel and Snake Case
- Typescript Support
Installation
$ npm install keys-transform$ yarn add keys-transformCode Example
const {toLowerKeys, toUpperKeys, toCamelKeys, toSnakeKeys, changeKeys} = require('keys-transform');
const obj = {
"NAME_ME": "Nahid Chowdhury",
"AGE": 26,
"hobby": ["Coding", "singing"],
"job": {
"professional": "engineer",
"personal": null
},
"planet_Belongs": undefined,
"nesT": {
"dummy_me": {
"hellO": "world"
}
}
}
/**
* Lower case object keys recursively
* @param {Object} objectToCon
*/
console.log(toLowerKeys(obj));
/**
* Upper case object keys recursively
* @param {Object} objectToCon
*/
console.log(toUpperKeys(obj));
/**
* Camel case object keys recursively
* @param {Object} objectToCon
*/
console.log(toCamelKeys(obj));
/**
* Snake case object keys recursively
* @param {Object} objectToCon
*/
console.log(toSnakeKeys(obj));
/**
* Change object keys name recursively
* @param {Object} objectToCon
* @param {Object} changedKeys
*/
console.log(changeKeys(obj, {
"NAME_ME": "name",
"professional": "occupation"
}));
Stay in touch
- Author - Nahid Chowdhury
License
Keys-Transform is MIT licensed.