{"_id":"@bitchcraft/ocake","_rev":"7-96a4ee263217c8f43a497c98cf5aff91","name":"@bitchcraft/ocake","dist-tags":{"latest":"1.0.2"},"versions":{"1.0.0":{"name":"@bitchcraft/ocake","version":"1.0.0","private":false,"description":"Object keys case converter (and collection of case string converters)","license":"BSD-3-Clause","dependencies":{"no-case":"^2.3.2"},"devDependencies":{"babel-cli":"^6.18.0","babel-core":"^6.20.0","babel-eslint":"^8.2.2","babel-jest":"^20.0.3","babel-loader":"^7.1.3","babel-plugin-add-module-exports":"^0.2.1","babel-plugin-module-resolver":"^3.1.0","babel-plugin-transform-runtime":"^6.15.0","babel-preset-env":"^1.6.1","babel-preset-flow":"^6.23.0","babel-preset-react":"^6.24.1","babel-preset-stage-0":"^6.16.0","eslint":"^4.18.1","eslint-config-airbnb-base":"^12.1.0","eslint-plugin-flowtype":"^2.46.1","eslint-plugin-flowtype-errors":"^3.3.7","eslint-plugin-import":"^2.9.0","eventsource-polyfill":"^0.9.6","expect":"^1.13.2","flow-bin":"^0.66.0","jest":"^20.0.4","webpack":"^3.11.0","webpack-bundle-analyzer":"^2.11.0"},"jest":{"moduleFileExtensions":["js"],"moduleDirectories":["node_modules"],"unmockedModulePathPatterns":["babel-loader","babel-plugin-react-transform","babel-jest"]},"scripts":{"test":"node_modules/jest/bin/jest.js","prestart":"yarn install; yarn run test; if [ -e ./dist ]; then rm -rf ./dist; fi;","start":"yarn run bundle","bundle":"NODE_ENV=production ./node_modules/webpack/bin/webpack.js --progress"},"author":{"name":"Josh Li","url":"https://github.com/maddrag0n"},"contributors":[],"main":"lib/ocake.es5.js","repository":{"type":"git","url":"https://github.com/bitchcraft/unicorn-logger"},"licenseText":"# License (BSD-3-Clause)\n\nCopyright 2016 Josh Li\n\nRedistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:\n\n1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.\n\n2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.\n\n3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.\n\nTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n","_id":"@bitchcraft/ocake@1.0.0","dist":{"shasum":"7c8b498b6dbc0ca69def9ad19e62253f6e4dfebe","tarball":"https://registry.npmjs.org/@bitchcraft/ocake/-/ocake-1.0.0.tgz","fileCount":44,"unpackedSize":306927,"integrity":"sha512-ygmXYEjwn/vTigcDplFCl3dxDz3wzw+HsRRNOGKvaplxTmlEMSUJX0sNQ7y31q1MC8ytEQN6xSduFXJiJbYJNw==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIG9FePqOUqgSr0mLlUH4toCvS6H+/TAXTQSGnoRAieWFAiEA+dxKT2/z74J7uB94CLhab0bObgP2S9M7r11hGrmXT/M="}]},"maintainers":[{"name":"maddrag0n","email":"bxxxxcraft@gmail.com"}],"_npmUser":{"name":"maddrag0n","email":"bxxxxcraft@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ocake_1.0.0_1520185610214_0.5811302126672115"},"_hasShrinkwrap":false},"1.0.1":{"name":"@bitchcraft/ocake","version":"1.0.1","private":false,"description":"Object keys case converter (and collection of case string converters)","license":"BSD-3-Clause","dependencies":{"no-case":"^2.3.2"},"devDependencies":{"babel-cli":"^6.18.0","babel-core":"^6.20.0","babel-eslint":"^8.2.2","babel-jest":"^20.0.3","babel-loader":"^7.1.3","babel-plugin-add-module-exports":"^0.2.1","babel-plugin-module-resolver":"^3.1.0","babel-plugin-transform-runtime":"^6.15.0","babel-preset-env":"^1.6.1","babel-preset-flow":"^6.23.0","babel-preset-react":"^6.24.1","babel-preset-stage-0":"^6.16.0","eslint":"^4.18.1","eslint-config-airbnb-base":"^12.1.0","eslint-plugin-flowtype":"^2.46.1","eslint-plugin-flowtype-errors":"^3.3.7","eslint-plugin-import":"^2.9.0","eventsource-polyfill":"^0.9.6","expect":"^1.13.2","flow-bin":"^0.66.0","jest":"^20.0.4","webpack":"^3.11.0","webpack-bundle-analyzer":"^2.11.0"},"jest":{"moduleFileExtensions":["js"],"moduleDirectories":["node_modules"],"unmockedModulePathPatterns":["babel-loader","babel-plugin-react-transform","babel-jest"]},"scripts":{"test":"node_modules/jest/bin/jest.js","prestart":"yarn install; yarn run test; if [ -e ./dist ]; then rm -rf ./dist; fi;","start":"yarn run bundle","bundle":"NODE_ENV=production ./node_modules/webpack/bin/webpack.js --progress"},"author":{"name":"Josh Li","url":"https://github.com/maddrag0n"},"contributors":[],"main":"lib/ocake.es5.js","repository":{"type":"git","url":"https://github.com/bitchcraft/unicorn-logger"},"licenseText":"# License (BSD-3-Clause)\n\nCopyright 2016 Josh Li\n\nRedistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:\n\n1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.\n\n2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.\n\n3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.\n\nTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n","_id":"@bitchcraft/ocake@1.0.1","dist":{"shasum":"7b101ab284b0be7a51e9dddeffd11177a288bdd5","tarball":"https://registry.npmjs.org/@bitchcraft/ocake/-/ocake-1.0.1.tgz","fileCount":44,"unpackedSize":307001,"integrity":"sha512-KwOqaJm36DDpBBTMsJBedoCE5t55aX0GnhMoScaVJX6195Ee1Lk648n2O15k7rdIdJU2FTyKLtMetFrSgu9V9g==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCENsahF+z9zsgGnfIK6yL+XVU2r92sAaesnTmoUhlXKQIgKaNo4kZ+DliGpudNq539w4W2t+ph01Q5Bb3zSdvrcdk="}]},"maintainers":[{"name":"maddrag0n","email":"bxxxxcraft@gmail.com"}],"_npmUser":{"name":"maddrag0n","email":"bxxxxcraft@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ocake_1.0.1_1520186821500_0.010387894377472895"},"_hasShrinkwrap":false},"1.0.2":{"name":"@bitchcraft/ocake","version":"1.0.2","private":false,"description":"Object keys case converter (and collection of case string converters)","license":"BSD-3-Clause","dependencies":{"no-case":"^2.3.2"},"devDependencies":{"babel-cli":"^6.18.0","babel-core":"^6.20.0","babel-eslint":"^8.2.2","babel-jest":"^20.0.3","babel-loader":"^7.1.3","babel-plugin-add-module-exports":"^0.2.1","babel-plugin-module-resolver":"^3.1.0","babel-plugin-transform-runtime":"^6.15.0","babel-preset-env":"^1.6.1","babel-preset-flow":"^6.23.0","babel-preset-react":"^6.24.1","babel-preset-stage-0":"^6.16.0","eslint":"^4.18.1","eslint-config-airbnb-base":"^12.1.0","eslint-plugin-flowtype":"^2.46.1","eslint-plugin-flowtype-errors":"^3.3.7","eslint-plugin-import":"^2.9.0","eventsource-polyfill":"^0.9.6","expect":"^1.13.2","flow-bin":"^0.66.0","jest":"^20.0.4","webpack":"^3.11.0","webpack-bundle-analyzer":"^2.11.0"},"jest":{"moduleFileExtensions":["js"],"moduleDirectories":["node_modules"],"unmockedModulePathPatterns":["babel-loader","babel-plugin-react-transform","babel-jest"]},"scripts":{"test":"node_modules/jest/bin/jest.js","prestart":"yarn install; yarn run test; if [ -e ./dist ]; then rm -rf ./dist; fi;","start":"yarn run bundle","bundle":"NODE_ENV=production ./node_modules/webpack/bin/webpack.js --progress"},"author":{"name":"Josh Li","url":"https://github.com/maddrag0n"},"contributors":[],"main":"lib/ocake.es5.js","repository":{"type":"git","url":"https://github.com/bitchcraft/unicorn-logger"},"licenseText":"# License (BSD-3-Clause)\n\nCopyright 2016 Josh Li\n\nRedistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:\n\n1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.\n\n2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.\n\n3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.\n\nTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n","_id":"@bitchcraft/ocake@1.0.2","dist":{"shasum":"347fd830ba7dd7149d47b4251f36d9a7f8a69687","tarball":"https://registry.npmjs.org/@bitchcraft/ocake/-/ocake-1.0.2.tgz","fileCount":46,"unpackedSize":307780,"integrity":"sha512-9Z8g0XPba++KQJx7uwRLedFR9hXCq5rYMG1x6CzHL1HQ80+8xfqLVOnfFJ+OeaDaQZ8OPVW4Xl68M2BppoPirg==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIGkJf/79Uv5X86LT27Bf1teVHHh4Q/xHJ8gPCiidsWfNAiEAyr3Ikg8NDZ0FfR2nAlgnw90SUMTLUwIy0ffGAfxgE2U="}]},"maintainers":[{"name":"maddrag0n","email":"bxxxxcraft@gmail.com"}],"_npmUser":{"name":"maddrag0n","email":"bxxxxcraft@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ocake_1.0.2_1520188264315_0.8092050272984703"},"_hasShrinkwrap":false}},"time":{"created":"2018-03-04T17:46:50.131Z","1.0.0":"2018-03-04T17:46:50.378Z","modified":"2022-06-12T15:16:12.712Z","1.0.1":"2018-03-04T18:07:01.579Z","1.0.2":"2018-03-04T18:31:04.532Z"},"maintainers":[{"email":"bcnpmjs@gmail.com","name":"bcnpmjs"},{"email":"krausethiemo@googlemail.com","name":"thiemok"},{"email":"bxxxxcraft@gmail.com","name":"maddrag0n"}],"description":"Object keys case converter (and collection of case string converters)","repository":{"type":"git","url":"https://github.com/bitchcraft/unicorn-logger"},"contributors":[],"author":{"name":"Josh Li","url":"https://github.com/maddrag0n"},"license":"BSD-3-Clause","readme":"# @bitchcraft/ocake\n\n```\n  ,.·——–——·.¸\n,°   ≡OCAKE≡  °,\n|   ,––––––––––.\\\n \\¸| (OMNOMNOM)'/\n   ``----------´\n```\n\nConvert the case of keys in an object (e. g. to camelCase), or simply convert the case of a string to another case.\n\n```js\n{ camelCased: 'some value' } => { snake_cased: 'some value' }\n```\n\n\n## Installation\n\n```sh\n$ yarn add @bitchcraft/ocake\n$ npm install -P @bitchcraft/ocake\n```\n\n## Usage\n\n### convertKeys\n\n```js\nconvertKeys(haystack: Object, replacer: (key: string) => string): Object\n```\n\nCreates an identical object where the keys have been converted to the desired case.\n\n* **haystack** can be any plain object including arrays\n* **replacer** function which takes a string and returns a string: `(key: string) => string`. You can use one of the supplied StringConverters.\n\n#### ES6 example\n\n```js\nimport { convertKeys, StringConverters } from '@bitchcraft/ocake';\n\nconst payload = convertKeys({\n    userName: 'Sam Axe',\n    userId: 5462,\n    clientId: 17,\n}, StringConverters.toKebabCase);\n\nconst requestBody = JSON.stringify(payload);\n```\n\n#### ES5 example\n\n```js\nvar convertKeys = require('@bitchcraft/ocake').convertKeys;\nvar toKebabCase = require('@bitchcraft/ocake').StringConverters.toKebabCase;\n\nvar payload = convertKeys({\n    userName: 'Sam Axe',\n    userId: 5462,\n    clientId: 17\n}, StringConverters.toKebabCase);\n\nconst requestBody = JSON.stringify(payload);\n```\n\n### StringConverters\n\nConvert the case in a string to another case, e. g.\n```js\n'sentence case' => 'sentenceCase'\n```\n\nAll string converters provided by OCake currently use [no-case](https://yarn.pm/no-case), which converts using a common intermediary. There are no source-target-pair specific replacers. Meaning that every conversion in fact first converts to sentence case before converting to the target case, e. g. when converting to snake case: `'unknownCase' -> 'unknown case' -> 'unknown_case'`. This has to be kept in mind when designing your app for roundtrip conversion. In that case you either have to be aware of the limitations or provide your own source-target specific replacers.\n\nKnown limitations are:\n\n* Tall-man-case does not work roundtrip, because of ambiguity with camel case. (`'someTALLMANCASEkey' -> 'some tallmancase ekey' -> 'someTallmancaseEkey' -> 'some tallmancase ekey' -> 'someTALLMANCASekey' -> …`)\n* Odd camel case is not preserved on roundtrip (`'XMLHttpRequest' -> 'xml http request' -> 'XmlHttpRequest'`)\n* When converting keys that contain numbers, some cases cannot properly store subtle differences, e. g. (`'snake_case_1' -> 'snakeCase1' -> 'snake_case1'`)\n\n**List of provided StringReplacers**\n\n| Replacer             | Description                |\n|:-------------------- |:-------------------------- |\n| `toCamelCase()`      | alias for toLowerCamelCase |\n| `toLowerCamelCase()` | e. g. `'theCakeIsFake'`    |\n| `toUpperCamelCase()` | e. g. `'TheCakeIsFake'`    |\n| `toKebabCase()`      | e. g. `'the-cake-is-fake'` |\n| `toAngryKebabCase()` | e. g. `'THE-CAKE-IS-FAKE'` |\n| `toSnakeCase()`      | e. g. `'the_cake_is_fake'` |\n| `toAngrySnakeCase()` | e. g. `'THE_CAKE_IS_FAKE'` |\n| `toSentenceCase()`   | e. g. `the cake is fake`   |\n| `toTitleCase()`      | e. g. `'The Cake Is Fake'` |\n| `toShoutCase()`      | e. g. `'THE CAKE IS FAKE'` |\n| `toTallManCase()`    | e. g. `'theCAKEisFAKE'`    |\n\n### ES2015+ imports with flow types\n\n```js\n// babel: env, stage-0, flow\nimport { convertKeys, StringConverters } from '@bitchcraft/ocake/src/Ocake';\nimport convertKeys from '@bitchcraft/ocake/src/convertKeys';\nimport StringConverters, { toCamelCase, … } from '@bitchcraft/ocake/src/StringConverters';\n```\n\n# Bundle size\n\nGzipped size (non-minified) is around 19KB, with 47% of that taken up by core-js. You can check out the [bundle analytics](./lib/es5-bundle-analytics.html) for the non-minified bundle.\n\n# Help and feedback\n\nPlease file issues in [Github](https://github.com/@bitchcraft/ocake/issues)\n\n# Contribute\n\nWe are open for [PRs](https://github.com/@bitchcraft/ocake/pulls). Please respect to the linting rules.\n\n# License\n\nKeyconst is free software und the BSD-3-Clause (see [LICENSE.md](./LICENSE.md)).\n\n# Contributors\n\n- [Josh Li](https://github.com/maddrag0n) (Maintainer)\n","readmeFilename":"README.md"}