
Security News
TypeScript is Porting Its Compiler to Go for 10x Faster Builds
TypeScript is porting its compiler to Go, delivering 10x faster builds, lower memory usage, and improved editor performance for a smoother developer experience.
object-case-converter
Advanced tools
Convert keys in an javascript object for some cases(camelCase, snake_case, etc.)
Convert keys in an javascript Object or Array to the specific forms(camelCase, snake_case, etc.)
$ npm install --save object-case-converter
import { camelCase, snakeCase } from 'object-case-converter';
const result1 = camelCase(null);
// result1 = null
const result2 = camelCase({
id: '1',
nick_name: 'nick1',
contacts: [{ contact_type: 'phone', value: '000-000-000' }, { contact_type: 'email', value: 'test@email.com' }],
news_letter: { all_email: false, marketing_email: false },
});
// result2 = {
// id: '1',
// nickName: 'nick1',
// contacts: [{ contact_type: 'phone', value: '000-000-000' }, { contact_type: 'email', value: 'test@email.com' }],
// newsLetter: { all_email: false, marketing_email: false },
//}
const result3 = snakeCase([
{ id: '1', nickName: 'nick1', contacts: [{ contactType: 'phone', value: '000-000-000' }, { contactType: 'email', value: 'test@email.com' }] },
{ id: '2', nickName: 'nick2', contacts: [] },
{ id: '3', nickName: 'nick3', contacts: [{ contactType: 'address', value: 'xxx' }] },
], true);
// result3 = [
// { id: '1', nick_name: 'nick1', contacts: [{ contact_type: 'phone', value: '000-000-000' }, { contact_type: 'email', value: 'test@email.com' }] },
// { id: '2', nick_name: 'nick2', contacts: [] },
// { id: '3', nick_name: 'nick3', contacts: [{ contact_type: 'address', value: 'xxx' }] },
//]
var converter = require('object-case-converter');
converter.camelCase(...);
converter.snakeCase(...);
Convert keys in an object or objects in an array to camelCase
Convert keys in an object or objects in an array to snake_case
$ git clone git@github.com:ridibooks/object-case-converter.git
$ cd object-case-converter
$ npm install
Webpack build using Babel (Not required in development.)
$ npm run build
Tests using Jest
$ npm test
FAQs
Convert keys in an javascript object for some cases(camelCase, snake_case, etc.)
We found that object-case-converter demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 4 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
TypeScript is porting its compiler to Go, delivering 10x faster builds, lower memory usage, and improved editor performance for a smoother developer experience.
Research
Security News
The Socket Research Team has discovered six new malicious npm packages linked to North Korea’s Lazarus Group, designed to steal credentials and deploy backdoors.
Security News
Socket CEO Feross Aboukhadijeh discusses the open web, open source security, and how Socket tackles software supply chain attacks on The Pair Program podcast.