{"name":"@solid-primitives/utils","version":"6.3.0","description":"A bunch of reactive utility types and functions, for building primitives with Solid.js","author":{"name":"Damian Tarnawski @thetarnav","email":"gthetarnav@gmail.com"},"contributors":[{"name":"Tom Pichaud","email":"dev.tompichaud@icloud.com"}],"license":"MIT","homepage":"https://github.com/solidjs-community/solid-primitives/tree/main/packages/utils#readme","repository":{"type":"git","url":"git+https://github.com/solidjs-community/solid-primitives.git"},"bugs":{"url":"https://github.com/solidjs-community/solid-primitives/issues"},"private":false,"sideEffects":false,"type":"module","module":"./dist/index.js","types":"./dist/index.d.ts","browser":{},"exports":{".":{"@solid-primitives/source":"./src/index.ts","import":{"types":"./dist/index.d.ts","default":"./dist/index.js"}},"./immutable":{"@solid-primitives/source":"./src/immutable/index.ts","import":{"types":"./dist/immutable/index.d.ts","default":"./dist/immutable/index.js"}}},"typesVersions":{"*":{"immutable":["./dist/immutable/index.d.ts"]}},"keywords":["utilities","reactivity","solid","primitives"],"peerDependencies":{"solid-js":"^1.6.12"},"devDependencies":{"solid-js":"^1.8.7"},"scripts":{"dev":"tsx ../../scripts/dev.ts","build":"tsx ../../scripts/build.ts","vitest":"vitest -c ../../configs/vitest.config.ts","test":"pnpm run vitest","test:ssr":"pnpm run vitest --mode ssr"},"_id":"@solid-primitives/utils@6.3.0","_integrity":"sha512-e7hTlJ1Ywh2+g/Qug+n4L1mpfxsikoIS4/sHE2EK9WatQt8UJqop/vE6bsLnXlU1xuhb/jo94Ah5Y27rd4wP7A==","_resolved":"/tmp/00414d15ce373621927778942f3b54a4/solid-primitives-utils-6.3.0.tgz","_from":"file:solid-primitives-utils-6.3.0.tgz","_nodeVersion":"20.18.1","_npmVersion":"10.8.2","dist":{"integrity":"sha512-e7hTlJ1Ywh2+g/Qug+n4L1mpfxsikoIS4/sHE2EK9WatQt8UJqop/vE6bsLnXlU1xuhb/jo94Ah5Y27rd4wP7A==","shasum":"5659e9788e8fe385c75c78c2f12a5e7bcc9f448d","tarball":"http://registry-npm.ywwl.com/@solid-primitives/utils/download/@solid-primitives/utils-6.3.0.tgz","fileCount":21,"unpackedSize":45451,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEYCIQCtEH+WBIt00uYDKEww5K0cEH03iSLcn0nG2WwtlQMEAQIhAMDy8ZuqRRwj7EA7aPkoHro7w5lmVMp+CytET4jvRk9d"}],"size":11471,"noattachment":false,"key":"/@solid-primitives/utils/-/@solid-primitives/utils-6.3.0.tgz"},"_npmUser":{"name":"thetarnav.","email":"gthetarnav@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/utils_6.3.0_1737584504581_0.028561600060366565"},"_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":1737584504773,"maintainers":[{"name":"davedbase","email":"dave.dibiase@gmail.com"},{"name":"lexlohr","email":"alex.th.kloss.77@googlemail.com"},{"name":"thetarnav.","email":"gthetarnav@gmail.com"}],"_cnpm_publish_time":1737584504773,"dist-tags":{"beta":"5.4.0-beta.0","latest":"7.0.1","next":"7.0.0-next.8"}}