{"name":"mixme","description":"A library for recursive merging of Javascript objects","version":"0.5.1","author":{"name":"David Worms","email":"david@adaltas.com","url":"https://www.adaltas.com"},"contributors":[],"devDependencies":{"@babel/core":"^7.13.16","@babel/preset-env":"^7.13.15","coffeescript":"^2.5.1","mocha":"^8.3.2","rollup":"^2.45.2","rollup-plugin-babel":"^4.3.2","should":"^13.2.3"},"engines":{"node":">= 8.0.0"},"homepage":"https://github.com/adaltas/node-mixme","bugs":{"url":"https://github.com/adaltas/node-mixme/issues"},"keywords":["merge","deep","extend","copy","clone","recursive"],"license":"MIT","main":"dist/mixme.cjs.js","module":"dist/mixme.esm.js","mocha":{"throw-deprecation":true,"require":["should","./coffee.config.js"],"inline-diffs":true,"timeout":40000,"reporter":"spec","recursive":true},"repository":{"type":"git","url":"git+https://github.com/adaltas/node-mixme.git"},"scripts":{"preversion":"grep '## Trunk' CHANGELOG.md && npm test","version":"version=`grep '^  \"version\": ' package.json | sed 's/.*\"\\([0-9\\.]*\\)\".*/\\1/'` && sed -i \"s/## Trunk/## Version $version/\" CHANGELOG.md && git add CHANGELOG.md","postversion":"git push origin master && git push origin master --tags && npm publish","patch":"npm version patch -m 'Bump to version %s'","minor":"npm version minor -m 'Bump to version %s'","major":"npm version major -m 'Bump to version %s'","build":"coffee -b -o lib src && rollup -c","pretest":"npm run build","test":"mocha test/**/*.coffee"},"gitHead":"0ae91325065dd8693eb457492c210ff9a3fa6f7b","_id":"mixme@0.5.1","_nodeVersion":"14.15.5","_npmVersion":"7.6.3","dist":{"integrity":"sha512-NaeZIckeBFT7i0XBEpGyFcAE0/bLcQ9MHErTpnU3bLWVE5WZbxG5Y3fDsMxYGifTo5khDA42OquXCC2ngKJB+g==","shasum":"b3da79a563b2da46efba9519830059e4c2a9e40f","tarball":"http://registry-npm.ywwl.com/mixme/download/mixme-0.5.1.tgz","fileCount":7,"unpackedSize":19763,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJgheGNCRA9TVsSAnZWagAA9m4P/18lMJuujhCsByUdauiJ\nGfAdmKnIu5Av0GVRTVp0X6TyKi8gBs2eAFG8UezGJ3lKPh/q3k9Btbd+ARyu\nPC9UdSVGhd7Hrk6xD+qJzW0PPfRGRkLKe2ejdhMECcYnu9oVPZZA8S46PeT9\nJiRQ1xHCo53QK2Ld1cd/HB0VmxuNB/YTSuXfWPiAj3vd7YrDhMNBrgbSQART\nKCpeby31mB3rwsLBauhSUTp6wuBHm3fMweJcKOCSXBvIhPplkw7oEYACIjd+\nkd3Ul77s/sPyDtD2MDAiqV5/eFBi6aymts8hR+EDDYWMqCIl/VdtY6nYpz2m\nmmuO1pV6a9PUCRcgvZLzgTqmDpkAl4rbovMcH5tfRK97fiICAEUcCM9eTw9N\n4SwUkxa69JTuyf1CtY5qBL9JMonJqcfEEeC0D+gJq9jWuLpGxTYFLNSHxCeJ\naLKv5eDFcf2ZdbtG+bBycuNI0M7Ireg8Qg4OZLnLpk3J+P86E2ZqJRiSsods\nF/FC0yJ6teMx1U6r3B0eE8zn5Z6Wh4WGPZcJ3gdZXZNbYnsBysb87acAoNOB\nbEZSExzJ28m3QOmgE0gYr73jRjJD6BsXC2ypeB9igal9aAAZFdET3smy48YN\nMiZdVKmrpUPEUzcBzAB3PzjKUZp5hyBRLbT0jMhGNSeTXr1ODqOZSRLgCDqK\nOYcR\r\n=AYXb\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQC4mWup3UdZqpljpipRWEx7OeV9Bu3/6AKTcyaxTY3yJgIhAKP+MbxP6ypNG2wdu6cx2hCSV3orYEmyCaB+hf1AncJX"}],"size":4980,"noattachment":false,"key":"/mixme/-/mixme-0.5.1.tgz"},"_npmUser":{"name":"david","email":"david@adaltas.com"},"directories":{},"maintainers":[{"name":"david","email":"david@adaltas.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/mixme_0.5.1_1619386765167_0.45275682121112326"},"_hasShrinkwrap":false,"readme":"\n# Node.js mixme\n\n![Build Status](https://github.com/adaltas/node-mixme/actions/workflows/test.yml/badge.svg)\n\nMerge multiple object recursively, with TypeScript support. The last object takes precedence over the previous ones. Only objects are merged. Arrays are overwritten.\n\n- Zero dependencies\n- Small size\n- Pure functions\n- ESM and CommonJS support\n\n## API\n\nThe API is minimalist. The most popular functions are `merge`, `mutate` and `is_object_literal`.\n\n### Function `camelize(object)`\n\nClone a object and convert its properties into snake case.\n\n```js\nimport { snake_case } from \"mixme\"\n\nsnake_case({aA: \"1\", bB: cC: \"2\"})\n// Return {a_a: \"1\", b_b: c_c: \"2\"}\n```\n\n### Function `camelize_str(str)`\n\nConvert a camel case string to snake case, used internally by `snake_case`.\n\n```js\nimport { snake_case_str } from \"mixme\"\n\nsnake_case(\"myValue\")\n// Return \"my_value\"\n```\n\n### Function `compare(item_1, item_2)`\n\nCompare two items and return true if their values match.\n\n```js\nimport { compare } from \"mixme\"\n\ncompare([{a: 1}], [{a: 1}])\n// Return true\n\ncompare({a: 1}, {a: 2})\n// Return false\n```\n\n### Function `clone(data)`\n\nIt is possible to clone a literal object by simply calling `mixme` with this object as the first argument. Use the `clone` function in case you wish to clone any type of argument including arrays:\n\n```js\nimport { clone } from \"mixme\"\n\nconst target = clone([\"a\", \"b\"])\n// target is now a copy of source\n```\n\n### Function `is_object_literal(object)`\n\nUse the `is_object_literal` function to ensure an object is literate.\n\n```js\nimport { is_object_literal } from \"mixme\"\n\n// {} is literate\nis_object_literal({})\n\n// error is not literate\nis_object_literal(new Error(\"Catch me\"))\n\n// Array is not literate\nis_object_literal([])\n```\n\n### Function `merge(...data)`\n\nThe API is minimalist, \nMerge all literal object provided as arguments. This function is immutable, the source objects won't be altered.\n\n```js\nimport { merge } from \"mixme\"\n\nconst target = merge({a: \"1\"}, {b: \"2\"});\n// target is {a: \"1\", b: \"2\"}\n```\n\n### Function `mutate(...data)`\n\nUse the `mutate` function to enrich an object. The first argument will be mutated:\n\n```js\nimport { mutate } from \"mixme\"\n\nconst source = {a: \"1\"};\nconst target = mutate(source, {b: \"2\"});\ntarget.c = \"3\";\n// source and target are both {a: \"1\", b: \"2\", c: \"3\"}\n```\n\n### Function `snake_case(object)`\n\nClone a object and convert its properties into snake case.\n\n```js\nimport { snake_case } from \"mixme\"\n\nsnake_case({aA: \"1\", bB: cC: \"2\"})\n// Return {a_a: \"1\", b_b: c_c: \"2\"}\n```\n\n### Function `snake_case_str(str)`\n\nConvert a camel case string to snake case, used internally by `snake_case`.\n\n```js\nimport { snake_case_str } from \"mixme\"\n\nsnake_case(\"myValue\")\n// Return \"my_value\"\n```\n\n## Example\n\nCreate a new object from two objects:\n\n```js\nimport { merge } from \"mixme\"\n\nconst obj1 = { a_key: \"a value\", b_key: \"b value\"}\nconst obj2 = { b_key: \"new b value\"}\nconst result = merge(obj1, obj2)\n\nassert.eql(result.b_key, \"new b value\")\n```\n\nMerge an existing object with a second one:\n\n```js\nimport { mutate } from \"mixme\"\n\nconst obj1 = { a_key: \"a value\", b_key: \"b value\"};\nconst obj2 = { b_key: \"new b value\"};\nconst result = mutate(obj1, obj2)\n\nassert.eql(result, obj1)\nassert.eql(obj1.b_key, \"new b value\")\n```\n\n## Testing\n\nClone the repo, install the development dependencies and run the tests:\n\n```bash\ngit clone http://github.com/wdavidw/node-mixme.git .\nnpm install\nnpm run test\n```\n\n## Developers\n\nTo automatically generate a new version:\n\n```bash\nyarn run release\n```\n\nPackage publication is handled by the CI/CD with GitHub action.\n\nNote:\n\n- On release, both the publish and test workflows run in parallel. Not very happy about it but I haven't found a better way.\n- `yarn` does not call the \"postrelease\" script and `npm` fails if the `package-lock.json` file is present and git ignored.\n\n## Contributors\n\n- David Worms: <https://github.com/wdavidw>\n- Paul Farault: <https://github.com/PaulFarault>\n\nThis package is developed by [Adaltas](https://www.adaltas.com).\n","publish_time":1619386765371,"_cnpm_publish_time":1619386765371,"dist-tags":{"latest":"2.0.2"}}