{"name":"@solid-primitives/immutable","version":"0.1.8-beta.0","description":"Functional programming helpers for making non-mutating changes to data. Keeping it immutable.","author":{"name":"Damian Tarnawski @thetarnav","email":"gthetarnav@gmail.com"},"license":"MIT","homepage":"https://github.com/solidjs-community/solid-primitives/tree/main/packages/immutable#readme","repository":{"type":"git","url":"git+https://github.com/solidjs-community/solid-primitives.git"},"primitive":{"name":"immutable","stage":2,"list":["List of functions"],"category":"Utilities"},"private":false,"sideEffects":false,"type":"module","main":"./dist/index.cjs","module":"./dist/index.js","types":"./dist/index.d.ts","browser":{},"exports":{"import":{"types":"./dist/index.d.ts","default":"./dist/index.js"},"require":"./dist/index.cjs"},"keywords":["fp","immutable","solid","primitives"],"dependencies":{"@solid-primitives/utils":"^5.4.0-beta.0"},"peerDependencies":{"solid-js":"^1.6.0"},"typesVersions":{},"scripts":{"build":"jiti ../../scripts/build.ts","test":"vitest -c ../../configs/vitest.config.ts","test:ssr":"pnpm run test --mode ssr"},"readme":"<p>\r\n  <img width=\"100%\" src=\"https://assets.solidjs.com/banner?type=Primitives&background=tiles&project=Immutable\" alt=\"Solid Primitives Immutable\">\r\n</p>\r\n\r\n# @solid-primitives/immutable\r\n\r\n[![turborepo](https://img.shields.io/badge/built%20with-turborepo-cc00ff.svg?style=for-the-badge&logo=turborepo)](https://turborepo.org/)\r\n[![size](https://img.shields.io/bundlephobia/minzip/@solid-primitives/immutable?style=for-the-badge&label=size)](https://bundlephobia.com/package/@solid-primitives/immutable)\r\n[![version](https://img.shields.io/npm/v/@solid-primitives/immutable?style=for-the-badge)](https://www.npmjs.com/package/@solid-primitives/immutable)\r\n[![stage](https://img.shields.io/endpoint?style=for-the-badge&url=https%3A%2F%2Fraw.githubusercontent.com%2Fsolidjs-community%2Fsolid-primitives%2Fmain%2Fassets%2Fbadges%2Fstage-2.json)](https://github.com/solidjs-community/solid-primitives#contribution-process)\r\n\r\nFunctional programming helpers for making non-mutating changes to data. Keeping it immutable.\r\n\r\n## Installation\r\n\r\n```bash\r\nnpm install @solid-primitives/immutable\r\n# or\r\nyarn add @solid-primitives/immutable\r\n```\r\n\r\n## How to use it\r\n\r\n```ts\r\nimport { pick } from \"@solid-primitives/immutable\";\r\n\r\nconst original = { foo: 123, bar: \"baz\" };\r\nconst newObj = pick(original, \"foo\");\r\noriginal; // { foo: 123, bar: \"baz\" }\r\nnewObj; // { foo: 123 }\r\n```\r\n\r\nUse it for changing signals:\r\n\r\n```ts\r\nimport { push, update } from \"@solid-primitives/immutable\";\r\n\r\nconst [list, setList] = createSignal([1, 2, 3]);\r\nsetList(p => push(p, 4));\r\n\r\nconst [user, setUser] = createSignal({\r\n  name: \"John\",\r\n  street: { name: \"Kingston Cei\", number: 24 },\r\n});\r\nsetUser(p => update(p, \"street\", \"number\", 64));\r\n```\r\n\r\n## List of functions:\r\n\r\n### Copying\r\n\r\n- **`shallowArrayCopy`** - make shallow copy of an array\r\n- **`shallowObjectCopy`** - make shallow copy of an object\r\n- **`shallowCopy`** - make shallow copy of an array/object\r\n- **`withArrayCopy`** - apply mutations to the an array without changing the original\r\n- **`withObjectCopy`** - apply mutations to the an object without changing the original\r\n- **`withCopy`** - apply mutations to the an object/array without changing the original\r\n\r\n### Array\r\n\r\n- **`push`** - non-mutating `Array.prototype.push()`\r\n- **`drop`** - non-mutating function that drops n items from the array start\r\n- **`dropRight`** - non-mutating function that drops n items from the array end\r\n- **`filterOut`** - standalone `Array.prototype.filter()` that filters out passed item\r\n- **`filter`** - standalone `Array.prototype.filter()`\r\n- **`sort`** - non-mutating `Array.prototype.sort()` as a standalone function\r\n- **`sortBy`** - Sort an array by object key, or multiple keys\r\n- **`map`** - standalone `Array.prototype.map()` function\r\n- **`slice`** - standalone `Array.prototype.slice()` function\r\n- **`splice`** - non-mutating `Array.prototype.splice()` as a standalone function\r\n- **`fill`** - non-mutating `Array.prototype.fill()` as a standalone function\r\n- **`concat`** - Creates a new array concatenating array with any additional arrays and/or values.\r\n- **`remove`** - Remove item from array\r\n- **`removeItems`** - Remove multiple items from an array\r\n- **`flatten`** - Flattens a nested array into a one-level array\r\n- **`filterInstance`** - Flattens a nested array into a one-level array\r\n- **`filterOutInstance`** - Flattens a nested array into a one-level array\r\n\r\n### Object\r\n\r\n- **`omit`** - Create a new subset object without the provided keys\r\n- **`pick`** - Create a new subset object with only the provided keys\r\n- **`split`** - Split object into multiple subset objects.\r\n- **`merge`** - Merges multiple objects into a single one.\r\n\r\n### Object/Array\r\n\r\n- **`get`** - Get a single property value of an object by specifying a path to it.\r\n- **`update`** - Change single value in an object by key, or series of recursing keys.\r\n\r\n### Number\r\n\r\n- **`add`** - `a + b + c + ...` _(works for numbers or strings)_\r\n- **`substract`** - `a - b - c - ...`\r\n- **`multiply`** - `a * b * c * ...`\r\n- **`divide`** - `a / b / c / ...`\r\n- **`power`** - `a ** b ** c ** ...`\r\n- **`clamp`** - clamp a number value between two other values\r\n\r\n## Changelog\r\n\r\nSee [CHANGELOG.md](./CHANGELOG.md)\r\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/solidjs-community/solid-primitives/issues"},"_id":"@solid-primitives/immutable@0.1.8-beta.0","_integrity":"sha512-jEkCZSO8l6dyYQKvgQOi1Lv/w2FGOf7N7ontNNAc5O+Rr814WNxu54RFnWpaPiEmVfBB5SGMNvAcXBDdbCQx+A==","_resolved":"C:\\Users\\gthet\\AppData\\Local\\Temp\\656a2237f8b86ef0e786bf984fec1bc9\\solid-primitives-immutable-0.1.8-beta.0.tgz","_from":"file:solid-primitives-immutable-0.1.8-beta.0.tgz","_nodeVersion":"18.12.1","_npmVersion":"8.19.2","dist":{"integrity":"sha512-jEkCZSO8l6dyYQKvgQOi1Lv/w2FGOf7N7ontNNAc5O+Rr814WNxu54RFnWpaPiEmVfBB5SGMNvAcXBDdbCQx+A==","shasum":"ddf93ec7cb77b12a8b6d7239288e35215ab0824f","tarball":"http://registry-npm.ywwl.com/@solid-primitives/immutable/download/@solid-primitives/immutable-0.1.8-beta.0.tgz","fileCount":7,"unpackedSize":33564,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIDZt7LykNyE6E81aH7f1QC+eVjRZVmE7PLuGagMGXQDhAiBjdkLNLWz5ERCn7EnkYylIDhTwowhLk52S5SJ9RFC4Cg=="}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJkAbR5ACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmrPvg//YJEzWkvtk89Gq1ciQnOQIFE7EfNF0QYa4KGJ5dpSaG0dFMp5\r\nV/7R7jul9rVLUHxazj6lpQ/AZ7ETp7oGtTpNqeWi0rzHx+ZR0DTQspx4Vo19\r\n1DwnFVfSefpaZ1vtNQzkflDcyEHezHRww8FMuJen2h7RA+HyGVY51vjA4Cub\r\nI21zArPwCYFTIZzunv0TpDed9HKZgqFpKuzBKc+4CuhrtyMDjsCCOAgXLMv0\r\nd3Ylym5canhkkO9t/Xf0956HGHaTaQ47Luq5FB68Fl5J2lBfrHPBqZs3kDuA\r\n0ZhprQnI7mhKcWW1XroqL3M7RZpje1jUYl0mOlmSmCN050gtDL9EkUkKamXE\r\nUZi6jn7Atr4BMahH/FevHTpwIodv2BtlS8IBOAAAgW9sZfJ6bsKoeL8ZrMkR\r\n4mE3xeRZZt41KIIvH5NP9Gz5qN/IV4+XDYohw88qbVS9J6cPwUh23xDPdq/E\r\nsa69wFByAOnv08S0G1mqFABAFYLSA2iC4wm9Ik/MRXoO60od3U+lftUAVfKK\r\n1KHFnc0yDjyZeCf7UwYwXswZLGYWeFbmgUbEaP+9e3Z8R6+tfvFk3Pc1KvPy\r\nkbsX0/+TPsfxGlk0ItD3R98cvzBLmcWFjmQdFr+BZO2PP65AzmXiqqxysySH\r\nRhIk8FXsvoLteNhercVfRFfr+EZtlFNteic=\r\n=r+u6\r\n-----END PGP SIGNATURE-----\r\n","size":6783,"noattachment":false,"key":"/@solid-primitives/immutable/-/@solid-primitives/immutable-0.1.8-beta.0.tgz"},"_npmUser":{"name":"thetarnav.","email":"gthetarnav@gmail.com"},"directories":{},"maintainers":[{"name":"thetarnav.","email":"gthetarnav@gmail.com"},{"name":"lexlohr","email":"alex.th.kloss.77@googlemail.com"},{"name":"davedbase","email":"dave.dibiase@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/immutable_0.1.8-beta.0_1677833337522_0.5521572920156093"},"_hasShrinkwrap":false,"publish_time":1677833337749,"_cnpm_publish_time":1677833337749,"dist-tags":{"beta":"0.1.8-beta.0","latest":"1.1.5","next":"2.0.0-next.0"}}