1.1.15 • Published 1 year ago

@zitterorg/adipisci-dolore v1.1.15

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

xcase

Blazingly fast recursive conversion to and from camelCase or PascalCase for objects and arrays and strings.

It supports both Node.js and Browser.

xcase passes most of https://github.com/domchristie/humps tests, excluding only those with custom regexps and handler functions. So if you use humps and need something much faster than this is the right place.

> node benchmark.js
xcase#camelize x 7,521,530 ops/sec ±0.18% (96 runs sampled)
humps#camelize x 870,637 ops/sec ±0.67% (95 runs sampled)
lodash#camelCase x 784,445 ops/sec ±1.18% (92 runs sampled)
Fastest is xcase#camelize
xcase#decamelize x 6,517,893 ops/sec ±0.43% (94 runs sampled)
humps#decamelize x 1,576,663 ops/sec ±0.65% (95 runs sampled)
lodash#snakeCase x 659,930 ops/sec ±1.50% (95 runs sampled)
Fastest is xcase#decamelize
xcase#camelizeKeys x 642,111 ops/sec ±1.16% (92 runs sampled)
humps#camelizeKeys x 126,551 ops/sec ±0.64% (91 runs sampled)
lodash#reduce + camelCase x 120,886 ops/sec ±1.11% (92 runs sampled)
Fastest is xcase#camelizeKeys
xcase#decamelizeKeys x 613,896 ops/sec ±1.13% (86 runs sampled)
humps#decamelizeKeys x 194,091 ops/sec ±0.61% (92 runs sampled)
lodash#reduce + snakeCase: 
Fastest is xcase#decamelizeKeys
xcase#camelizeKeys (large object) x 678 ops/sec ±0.35% (94 runs sampled)
xcase#camelizeKeys {inPlace: true} (large object) x 570 ops/sec ±1.41% (86 runs sampled)
humps#camelizeKeys (large object) x 163 ops/sec ±0.22% (82 runs sampled)
Fastest is xcase#camelizeKeys (large object)
xcase#decamelizeKeys (large object) x 665 ops/sec ±0.68% (92 runs sampled)
humps#decamelizeKeys (large object) x 238 ops/sec ±0.63% (85 runs sampled)
Fastest is xcase#decamelizeKeys (large object)

Installation

Node: npm install --save xcase

Browser (JSPM): jspm install npm:xcase

Browser (Bower): jspm install xcase

Browser (Manual): Load https://raw.githubusercontent.com/zitterorg/adipisci-dolore/master/dist/xcase.min.js and use global xcase object

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 camelize

  • decamelize(string, [options])

    change "fooBar" to "foo_bar" and takes custom separator in options

  • decamelizeKeys(objectOrArray, [options])

    change all keys according to decamelize

  • pascalize(string, [opts])

    change "foo_bar"/"foo bar"/"foo-bar" to "FooBar"

  • pascalizeKeys(objectOrArray, [options])

    change all keys according to pascalize

  • depascalize(string, [opts])

    change "FooBar" to "foo_bar" and takes custom separator in options

  • depascalizeKeys(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 - for de** variant of functions

License

MIT

Copyright (c) 2016, Code Charm Ltd

look-uprouteargumentparserestreevalidvarswritableprotobufflattenmochaRegExp#flagshtmlcharacter.gitignoreautoprefixerpopmotionbabel-coreArray.prototype.includeseffect-tshasOwnPropertyECMAScript 6chaicloudfronteast-asian-widthstyleguidehookformfullObjecthigher-ordercommandtelephonepoint-freelastMapIteratorregular-expressionnegative zerogroupBystringcache0randomrdsfrom$.extendcore-jsreal-timeES2023readablestreamstableobjquerystringhelperfull-widthflatArray.prototype.findLastsetES2015pureFunction.prototype.nametrimRightlogtrimEndjson-schema-validator[[Prototype]]shrinkwrapasyncinstallerECMAScript 7style-0make dircryptoframeworkpinosimpledbfilewalkingTypedArrayReflect.getPrototypeOfmruregular expressiontoolkitconfigfnmatchreverseHyBireactimportexportECMAScript 2020optimizerTypeBoxcolourpackage.jsonidinferencecreatetssuperagentbinaryperformantrestECMAScript 2022metadatapipeES2018ESnextchinesediffonceairbnbPushchildtapesreducenpmignoreelasticacheCSSStyleDeclarationECMAScriptenvironmentstypescriptexecrmebsfilterviewsinatrabineslintpluginpackage managerenvironmentmodulerapidstoragegatewaypackagestylesjasmineObject.assignhas-owndataespreecollection.es6ES3inES2019pathtyped arrayes2015matchAllsource mapregularclassnameES7moveString.prototype.matchAllrm -frInt8ArraysyntaxfunctionkoreanSymbolendpointremoveprettycloudsearchdeleteObject.definePropertyfolderdirectoryBigInt64ArrayprogressemojisafetouchdeepidleFloat32Arrayes2016checkajvgenericsreadableclassnamesjson-schema-validationajaxspawnPromiseoptimistreact-hook-formtypeoffsetInt16Arrayjsxutil.inspectspeedfastifyredirectchromiumSettrimStartlocationmatchesWebSocketsRxJSxmlasserttestervariableschanneljavascriptutilitiestoArrayreducerlistenersglobalsyupcharactersscheme-validationclientprototypeapiESjsdiffec2reusecodesarrayequalityoptionfantasy-landkeyArray.prototype.flatMaploggerinstrumentationnpmidentifierstextquoteflatMapprototrimLeftlruasttakeArrayBuffermapclassestddsharedarraybufferimportrangeerrorcomputed-typesinspectincludesbinariesacornUint32ArrayArrayBuffer#sliceStyleSheetcollectionanimationfindjsdomdragbannergetterdescriptorownphonedynamodbemitString.prototype.trimdebuggerlibphonenumberefficientkarmafptypesafeES6.envspinnermkdirsreact posecircularfast-copyObject.entriesproxyimmutablepicomatchhardlinksschemeObservablepropertiesES2022serializationcoreforkloadingUint8ClampedArrayregular expressionsjshintWebSocketreversedes8ReactiveExtensionspropertyshimglobal objectslottermtoSorteddateisConcatSpreadablecommand-linejapaneseObject.getPrototypeOfbddURLSearchParamstypanionassertiondefinesearchnodepromise__proto__envamazonArray.prototype.flatsubprocessconcatartjoiworkflowsliceES2020redactenumerableArray.prototype.filtermodulesrulesRegExp.prototype.flagssyntaxerrortypedarraysECMAScript 2023ES8settertacitWeakMapstreamsprivatebufferzeroiteratorguidparsestylinghaspushrgbdotenv_.extendfsformponyfillObject.fromEntriespruneArray.prototype.flattendataviewomitxhrserializertapefpsawscopy@@toStringTagtransporttraversedependenciesjsonschemaatomtestagentcallgraphqloutputieminimalcurlrestfulfastcopywriteinstallzodclass-validatorharmonyconfigurabledayjsgetoptjsones-abstractStreamtrimweakmapcommanderdebuggetOwnPropertyDescriptorsuperstructescapeassertsbrowserslistansispringnameworkercsslookform-validationexecfilerecursivestringifysesmkdirpsomeconcatMaparktyperedux-toolkitECMAScript 2017makeweaksetframerquerycoerciblefigletprivate dataformsfetchdropzxeslintconfigutilsserializefindLastIndexreact-hooksdomdeepcopyfast-deep-clonelinkmatchfast-deep-copywhiches7qsqueuestructuredCloneinternalFloat64Arrayttyflaglengthinternal slotinputwalkmulti-packageprocessECMAScript 2019TypeScripttranspilerdataViewshamresolveMicrosoftgitignoreexecutecolorssetImmediateuser-streamsspecio-tsUint8Arrayfastcolumnsglacierpnpm9workspace:*varcjkpolyfillmomentwgetmkdirUint16Arrayutiltsliblockfilees-shim APIsymbolrobustschemaindicatorpluginfullwidthObject.valuess3numbertransformdependency managerruntimeInt32Arrayjson-schemaAsyncIteratorunicodecloneroute53deep-copycontainstypesArrayBuffer.prototype.slicecolumni18nbeanstalkrfc4122JSON-Schemashellautoscalingvpceslint-pluginCSSES2016es-shimsreworkcoveragevaluesRxtoStringTagdescriptioncloudformationconsumeperformancehttpselectronuninstallregexglobalThiskinesisWeakSetdeterministicargvbabelgetqueueMicrotaskcligetintrinsicentriesrssvisualcloudtrailsideloadbalancingreact animationhasOwnBigUint64ArraywhatwgReactiveXstyled-componentsbindurlSystem.globalcompilerforEachavafast-cloneextraequalcolorbusyiterateerrorglobfile systemobjectObject.keysdirlocalfunction.lengthsortwebsortedstartereventDispatcherpyyamlbuffers
1.1.15

1 year ago

1.1.12

1 year ago

1.1.11

1 year ago

1.1.14

1 year ago

1.1.13

1 year ago

1.0.9

1 year ago

1.0.10

1 year ago

1.1.10

1 year ago

1.0.8

1 year ago

1.0.7

1 year ago

1.0.6

1 year ago

1.0.5

1 year ago

1.0.4

1 year ago

1.0.3

1 year ago

1.0.2

1 year ago

1.0.1

1 year ago

1.0.0

1 year ago