Package Exports
- xcase
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 (xcase) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
xcase
Blazingly fast recursive conversion to and from camelCase or PascalCase for Objects and Arrays.
It supports both Node.js and Browser. Node.js has a slightly more performant native implementation.
xcase passes most of https://github.com/domchristie/humps tests, excluding only those with custom regexps and handler functions. So if you use humps in Node and need something 4x faster then this is the right place.
> node benchmark.js
xcase#camelizeKeys x 667 ops/sec ±1.06% (91 runs sampled)
xcase#camelizeKeys {inPlace: true} x 594 ops/sec ±1.75% (83 runs sampled)
humps#camelizeKeys x 166 ops/sec ±0.24% (84 runs sampled)Installation
Node: npm install --save xcase
Browser: jspm install npm:xcase
Usage:
let {camelizeKeys} = require('xcase');
let obj = camelizeKeys({
foo_bar: 1
});
// obj is {fooBar: 1}API
camelize(string, [options])change
"foo_bar"/"foo bar"/"foo-bar"to"fooBar"camelizeKeys(objectOrArray, [options])change all keys according to
camelizedecamelize(string, [options])change
"fooBar"to"foo_bar"and takes customseparatorin optionsdecamelizeKeys(objectOrArray, [options])change all keys according to
decamelizepascalize(object, [opts])change
"foo_bar"/"foo bar"/"foo-bar"to"FooBar"pascalizeKeys(objectOrArray, [options])change all keys according to
pascalizedepascalize(string, [opts])change
"FooBar"to"foo_bar"and takes customseparatorin optionsdepascalizeKeys(objectOrArray, [options])change all keys according to
depascalize
Options:
inPlace: true- to modify existing object (note, it's slower than default! v8 is smarter than us)separator- for example-forde**variant of functions
License
MIT
Copyright (c) 2016, Code Charm Ltd