{"name":"mixme","description":"A library for recursive merging of Javascript objects","version":"0.5.5","author":{"name":"David Worms","email":"david@adaltas.com","url":"https://www.adaltas.com"},"contributors":[],"devDependencies":{"@commitlint/cli":"^13.1.0","@commitlint/config-conventional":"^13.1.0","@babel/core":"^7.15.5","@babel/preset-env":"^7.15.6","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"},"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":{"_postinstall":"husky install","prepublishOnly":"pinst --disable","postpublish":"pinst --enable","build":"coffee -b -o lib src src && rollup -c","pretest":"npm run build","test":"mocha 'test/**/*.coffee'","release":"standard-version","release:minor":"standard-version --release-as minor","release:patch":"standard-version --release-as patch","release:major":"standard-version --release-as major"},"gitHead":"792dbd079a88a481dab04fb29f1064cd6ae0a056","_id":"mixme@0.5.5","_nodeVersion":"16.19.0","_npmVersion":"8.19.3","dist":{"integrity":"sha512-/6IupbRx32s7jjEwHcycXikJwFD5UujbVNuJFkeKLYje+92OvtuPniF6JhnFm5JCTDUhS+kYK3W/4BWYQYXz7w==","shasum":"bf8f67d8caf10fdb49fd23198fd1fa6d8e406627","tarball":"http://registry-npm.ywwl.com/mixme/download/mixme-0.5.5.tgz","fileCount":6,"unpackedSize":20639,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQC90fXgu74TUehj+BffpNNqDU2Yj/jiChSaghfAwzHHdAIhALghQ9SFH0Fu5x0xMkGVqgsojzrGeGOlhKTc3RArmrfb"}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjylJ5ACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmpgew//e0R/09I+fn1xEElVhirYf38qABXFXJtyOhbmTycN0CFuZgx4\r\n78eKt+zNrBYYbbK0OxlXaIa7i3SwgbdXHPYeNJImMV+Zo/pvLG3qnCKwkfFD\r\nFZZ8gU1hDOXQ+/ofvz8rtLPPMgVkV0vfm23KXbtC8abTR7sR9+T/ZOJU9kS0\r\n8EZwaZ9Q7HY/ufox+GKPVZIUp+FuGGrTNnLR2C0fuP4dicBvAEQtLIFnk7hJ\r\nvI6CcubCgETRXuHQBd6UEQryz2d44akHJboNkQitSMAU3IQHzlgGW6irQ66w\r\nD2grHNYY76PlREr87WENU59bmYiQ8Er1qj/LC8mEg8D/U00du2FWu9HnUiml\r\nSRxU3nVM4s6vV8ipu8hOuZ3vOfLwfy4hrIswzY2nyWUqPacAe5cCveBqywya\r\ndA6A2mMFlW+YgXCtoR67oab+7uak1eQGRt4KscHVMww3hjy4dZoj/BB+VFv9\r\nf6tTeOSVgX+6Fn62QCD7fO5EkwZvhEsU77eWvkCbrMkDQzG9dOB2xA/xCrvX\r\nuSavOsj5bEWADjNW586jsdHwFGBNOIaCH5qOeGUhazCI57MRRskB36i552yy\r\nVjU2aVsRCUfVonxbMjO9KhRd48tXP68eN1AbOwqUWJ/v/mcVgBMw10jpG8Vu\r\nYZT3wV6MM53fYMiFK01z5ArjDoXq9TBjcnE=\r\n=7cof\r\n-----END PGP SIGNATURE-----\r\n","size":5048,"noattachment":false,"key":"/mixme/-/mixme-0.5.5.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.5_1674203769385_0.9975855059699494"},"_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":1674203769574,"_cnpm_publish_time":1674203769574,"dist-tags":{"latest":"2.0.2"}}