{"name":"@solid-primitives/utils","version":"0.0.150","description":"A bunch of reactive utility types and functions, for building primitives with Solid.js","author":{"name":"Damian Tarnawski @thetarnav","email":"gthetarnav@gmail.com"},"license":"MIT","homepage":"https://github.com/davedbase/solid-primitives/utils#readme","repository":{"type":"git","url":"git+https://github.com/davedbase/solid-primitives.git"},"private":false,"main":"dist/index.js","module":"dist/index.js","types":"dist/index.d.ts","exports":{"require":"./dist/cjs/index.js","import":"./dist/index.js","default":"./dist/index.js"},"sideEffects":false,"scripts":{"prebuild":"npm run clean","clean":"rimraf dist/","build":"tsc && tsc -p ./tsconfig-cjs.json","test":"uvu -r solid-register"},"keywords":["utilities","reactivity","solid","primitives"],"devDependencies":{"jsdom":"^18.1.1","prettier":"^2.4.1","rimraf":"^3.0.2","solid-register":"^0.0.18","tslib":"^2.3.1","typescript":"^4.5.2","uvu":"^0.5.2"},"peerDependencies":{"solid-js":"^1.2.5"},"gitHead":"6cf052f9b9f1a5cab145b4d831261f714a96de9b","bugs":{"url":"https://github.com/davedbase/solid-primitives/issues"},"_id":"@solid-primitives/utils@0.0.150","_nodeVersion":"16.13.0","_npmVersion":"8.1.0","dist":{"integrity":"sha512-LbT+T1g3QQp1vwssasEAgx2MiiQl/BDqbUjbLIKaNCBfkFIxMxJWfwiV9BRE+ntsLOUs+8LlP2oHnBNY60pqXA==","shasum":"7c496df40c60f9aff9f20fc0625d3689407c88d0","tarball":"http://registry-npm.ywwl.com/@solid-primitives/utils/download/@solid-primitives/utils-0.0.150.tgz","fileCount":6,"unpackedSize":6264,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJhoTS5CRA9TVsSAnZWagAAetUP/i1H0PhHK5B2B0nNPriZ\nXjfSOKLkN0M7CP0sBqv7TQy6L4fOBLhFvjgsoAbGRvI0VbVcigvefVl+dKUm\n0z2i2kIAPpiDpzA5cOcW1JwvK9cb5nySNtqQ4ct1rcZrsbIrNDAdqNsozEwe\nZSDFBK7qBNiBDKypHEwuSZkNccUaX5nh9i/0k9YJ1ybGbGpGe1C1ozjgL94/\nEu5CROkm5J/HTMODgvJR5pYhim383gy127gtKNfmVgnIwjvCEyUHmll6Ctwd\ntQBi3wPQ7EGAxCEke9G1tIlqlgS87falom9PpLvvn4NizK9ml45DkP0fYKfO\n8nnkjQ2fJGS3mK9VXUpwp/47B73toop+iN1BjKQZnqQOI0H0WOkXz+OtgROP\n9/5cS8+r5Wz7nf2SxKjt2pQ1bQRPzvu9kf/K44fAAXD+Jxrer2hqLayLxJEU\n/Ir4aFuVWUkSYj00N3Ex+KyetvGNVCOdHbk200YJ+nGyWaRS8obkvM81YdcB\nhBOaTlaDX9YSxpIg+MZGyHxm76D+i7U0wzxne7IbRzvGDlpCtjIQw7t1ybC+\nOmeclei3udBAh6nrk8ZujwEHSZSok7rqfjXdFPNROgQeL/c4DEaobOzUHOgc\n9OA65FWXQ/Zqsx4ksp9q/4mNd3dKzFesISdfd+TvDxvOgENpJ7hfsN3WD7A9\noJB/\r\n=W2pM\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIAbZsPTM14sBPC/e6uVi9heVvCZPKVjSBIAnH1GQljgqAiBCspdqYJ1EncO4KM4ttdxnnukk4UOZ2SQdYkKraqFDcg=="}],"size":2452,"noattachment":false,"key":"/@solid-primitives/utils/-/@solid-primitives/utils-0.0.150.tgz"},"_npmUser":{"name":"davedbase","email":"dave.dibiase@gmail.com"},"directories":{},"maintainers":[{"name":"lexlohr","email":"alex.th.kloss.77@googlemail.com"},{"name":"davedbase","email":"dave.dibiase@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/utils_0.0.150_1637954745504_0.5995899906158701"},"_hasShrinkwrap":false,"readme":"<p>\n  <img width=\"100%\" src=\"https://assets.solidjs.com/banner?type=Primitives&background=tiles&project=Utils\" alt=\"Solid Primitives Utils\">\n</p>\n\n# @solid-primitives/utils\n\nSolid Primitives Utilities is a support and helper package for a number of primitives in our library. Please free to augment or centralize useful utilities and methods in this package for sharing.\n\n## Installation\n\n```bash\nnpm install @solid-primitives/utils\n# or\npnpm add @solid-primitives/utils\n# or\nyarn add @solid-primitives/utils\n```\n\n## Immutable helpers\n\nFunctional programming helpers for making non-mutating changes to data. Keeping it immutable. Useful for updating signals.\n\n```ts\nimport { pick } from \"@solid-primitives/utils/immutable\";\n\nconst original = { foo: 123, bar: \"baz\" };\nconst newObj = pick(original, \"foo\");\noriginal; // { foo: 123, bar: \"baz\" }\nnewObj; // { foo: 123 }\n```\n\nUse it for changing signals:\n\n```ts\nimport { push, update } from \"@solid-primitives/utils/immutable\";\n\nconst [list, setList] = createSignal([1, 2, 3]);\nsetList(p => push(p, 4));\n\nconst [user, setUser] = createSignal({\n  name: \"John\",\n  street: { name: \"Kingston Cei\", number: 24 },\n});\nsetUser(p => update(p, \"street\", \"number\", 64));\n```\n\n## List of functions:\n\n### Copying\n\n- **`shallowArrayCopy`** - make shallow copy of an array\n- **`shallowObjectCopy`** - make shallow copy of an object\n- **`shallowCopy`** - make shallow copy of an array/object\n- **`withArrayCopy`** - apply mutations to the an array without changing the original\n- **`withObjectCopy`** - apply mutations to the an object without changing the original\n- **`withCopy`** - apply mutations to the an object/array without changing the original\n\n### Array\n\n- **`push`** - non-mutating `Array.prototype.push()`\n- **`drop`** - non-mutating function that drops n items from the array start\n- **`dropRight`** - non-mutating function that drops n items from the array end\n- **`filterOut`** - standalone `Array.prototype.filter()` that filters out passed item\n- **`filter`** - standalone `Array.prototype.filter()`\n- **`sort`** - non-mutating `Array.prototype.sort()` as a standalone function\n- **`sortBy`** - Sort an array by object key, or multiple keys\n- **`map`** - standalone `Array.prototype.map()` function\n- **`slice`** - standalone `Array.prototype.slice()` function\n- **`splice`** - non-mutating `Array.prototype.splice()` as a standalone function\n- **`fill`** - non-mutating `Array.prototype.fill()` as a standalone function\n- **`concat`** - Creates a new array concatenating array with any additional arrays and/or values.\n- **`remove`** - Remove item from array\n- **`removeItems`** - Remove multiple items from an array\n- **`flatten`** - Flattens a nested array into a one-level array\n- **`filterInstance`** - Flattens a nested array into a one-level array\n- **`filterOutInstance`** - Flattens a nested array into a one-level array\n\n### Object\n\n- **`omit`** - Create a new subset object without the provided keys\n- **`pick`** - Create a new subset object with only the provided keys\n- **`split`** - Split object into multiple subset objects.\n- **`merge`** - Merges multiple objects into a single one.\n\n### Object/Array\n\n- **`get`** - Get a single property value of an object by specifying a path to it.\n- **`update`** - Change single value in an object by key, or series of recursing keys.\n\n### Number\n\n- **`add`** - `a + b + c + ...` _(works for numbers or strings)_\n- **`substract`** - `a - b - c - ...`\n- **`multiply`** - `a * b * c * ...`\n- **`divide`** - `a / b / c / ...`\n- **`power`** - `a ** b ** c ** ...`\n- **`clamp`** - clamp a number value between two other values\n\n## Changelog\n\nSee [CHANGELOG.md](./CHANGELOG.md)\n","publish_time":1637954745692,"_cnpm_publish_time":1637954745692,"dist-tags":{"beta":"5.4.0-beta.0","latest":"7.0.1","next":"7.0.0-next.8"}}