{"name":"mixme","description":"A library for recursively merging JavaScript objects","version":"0.5.9","author":{"name":"David Worms","email":"david@adaltas.com","url":"https://www.adaltas.com"},"contributors":[{"name":"Paul Farault","email":"paul.farault@gmail.com"}],"devDependencies":{"@babel/core":"^7.15.5","@babel/preset-env":"^7.15.6","@commitlint/cli":"^13.1.0","@commitlint/config-conventional":"^13.1.0","@types/mocha":"^10.0.1","@types/node":"^18.15.3","coffeescript":"^2.6.0","husky":"^7.0.2","mocha":"^9.1.1","pinst":"^2.1.6","rollup":"^2.56.3","rollup-plugin-babel":"^4.4.0","should":"^13.2.3","standard-version":"^9.3.1","ts-node":"^10.9.1","typescript":"^4.9.5"},"engines":{"node":">= 8.0.0"},"homepage":"https://github.com/adaltas/node-mixme","bugs":{"url":"https://github.com/adaltas/node-mixme/issues"},"exports":{".":{"import":{"types":"./lib/index.d.ts","default":"./lib/index.js"},"require":{"types":"./dist/cjs/index.d.cts","default":"./dist/cjs/index.cjs"}}},"keywords":["clone","copy","deep","extend","merge","objects","recursive"],"license":"MIT","main":"./dist/cjs/index.cjs","mocha":{"inline-diffs":true,"loader":"ts-node/esm","recursive":true,"reporter":"spec","require":["should"],"throw-deprecation":true,"timeout":40000},"repository":{"type":"git","url":"git+https://github.com/adaltas/node-mixme.git"},"scripts":{"_postinstall":"husky install","prepublishOnly":"pinst --disable","postpublish":"pinst --enable","build":"npm run build:rollup && npm run build:ts","build:rollup":"rollup -c","build:ts":"cp lib/index.d.ts dist/cjs/index.d.cts && cp lib/*.ts dist/esm","test":"mocha 'test/**/*.{js,ts}'","release":"standard-version","release:minor":"standard-version --release-as minor","release:patch":"standard-version --release-as patch","release:major":"standard-version --release-as major"},"type":"module","types":"lib/index.d.ts","typesVersions":{"*":{".":["dist/esm/index.d.ts"]}},"dependencies":{},"gitHead":"a07385ad2436bba84516065e83d161f9920d358a","_id":"mixme@0.5.9","_nodeVersion":"19.5.0","_npmVersion":"9.3.1","dist":{"integrity":"sha512-VC5fg6ySUscaWUpI4gxCBTQMH2RdUpNrk+MsbpCYtIvf9SBJdiUey4qE7BXviJsJR4nDQxCZ+3yaYNW3guz/Pw==","shasum":"a5a58e17354632179ff3ce5b0fc130899c8ba81c","tarball":"http://registry-npm.ywwl.com/mixme/download/mixme-0.5.9.tgz","fileCount":11,"unpackedSize":33516,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCECyALvjwVr3qVGxF1QH47r7O8c+U+kcLA60mFLQ/YCgIhAOdk3A3ekEARLtT5vjA8TCZDgB+gCDmBbFGIKlGWKlJZ"}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJkE5BVACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmqh6hAAnDFBwpA5Kyl67e4O8AMWl87+nKw+sFIq4iQyIji0tvKkjH4J\r\ngO02n4HPR7gNWM30D6N1XN5GPKP78MRwTnsoudD8JOVLZ7sv5E6g4joB7nQ6\r\ns1k8sjpyGcXUxeczczt6htFS8GgAHex/gbBCPgSARfqtRvWVAh2ysuDa1FHI\r\njiU9cFIi1PDWFwft0Qr0p40gpNNG09hnHvbcJUuPmefVh67vMDF3C7tyHTcG\r\nidgUP+cowgVTcrZ3ZjhDUKlVR2kEMf++OiOV2yEgb3RP5s6Vzncxr/LQ8B0U\r\nj0Zy03V5ft1rQIBy5QGqm9KEEWG7Bj+gKyp+RXXMiu4duG40YsDFTcFwSY4V\r\nPq+mgsgkJBP9fXTu1/dYZSEXEBBBG07i4jUk6r8ke7/kVgZw34CAjIzFaftm\r\nijUvo/nsi4GoV3L4mV9J6tS8X28wjK1oH+Ewi38muEbLM5W7s/Zd2uq9Enbh\r\nEfWcCuCzd+gydCAP43YamiFdiFUZ8rDHMvhnvUlPok6z87tABMnSyeMrbSyk\r\n22R5m1YsD7rPdwxVxB5YdZZGY8amciM+V9BHPZjsR2CI4BP7cHij8XUDAwgH\r\nD/uepZht7I7MiWQNomZ7ojzVcRIAtA8ERIvEthFalN2TiaqfFFYLFgb1DOFP\r\ndSYHvEJ4+tUGoA59Gk4z+jKdFGpI6z8d6OE=\r\n=mAK7\r\n-----END PGP SIGNATURE-----\r\n","size":6072,"noattachment":false,"key":"/mixme/-/mixme-0.5.9.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.9_1679003733091_0.3496935761096698"},"_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":1679003733260,"_cnpm_publish_time":1679003733260,"dist-tags":{"latest":"2.0.2"}}