{"name":"@solid-primitives/utils","version":"0.0.200","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/cjs/index.cjs","module":"dist/index.js","types":"dist/index.d.ts","exports":{"require":"./dist/cjs/index.cjs","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":"9362eee0d2373f3321258c069de3aa8a0c61c15f","bugs":{"url":"https://github.com/davedbase/solid-primitives/issues"},"_id":"@solid-primitives/utils@0.0.200","_nodeVersion":"16.13.0","_npmVersion":"8.1.0","dist":{"integrity":"sha512-ZnfK9CtaTMab3wmgeaBuM6FC9IjF+PjrqjHHst22wSCUEtpc8ABzLu7E5GKt98SUStZgjBkYr46PMNliWAnwCQ==","shasum":"cf80c4c3901ffb6149aa4ce02881adc5b9099394","tarball":"http://registry-npm.ywwl.com/@solid-primitives/utils/download/@solid-primitives/utils-0.0.200.tgz","fileCount":6,"unpackedSize":7152,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJhpAr4CRA9TVsSAnZWagAAeboQAJ6qUtd5/N6t2zm3t4d9\ndLSSjX/jNaI7WnvRJhbvbKRXP1WM707qQaMMg8Iaf2zq3xu144jAyh+rmfpk\np5n6FfZ4eMXuLUSr4/+JUG2YEQdPsZWfiRn4r8qsH6SOdSdfcJXAHjgvl7ON\nbXltxYoKNGbmKDtBH3HKrTpZIiJ8wtm6b09thC+eS0/Lt/ZMS+EMelQXTY9i\nuBJSUyo+RpBrptC6HdZG/7sk5KdidQqCKwwbh84p+bzntJ28061XsQceK26Q\nOtBxE0ZVX4Pe8iSy6ZFLjYLGIe1B2DiPPwTp/znNvO+vWyeX0VIyB534hXP1\nCn5IeIagsQ+20WaWBxvefVzhUg99NIDcby3hdBUegnx+AWISlvc1D+3WzI0E\ndAXqdUYCuabDk78AMfZ0hiiEdREQakPE3RGkVbjEf3OeUnr0MSLl9Sj9xGCA\nfeIzPY1uhIm8KhyTnX4kyGWTivlhr1KP/8msYpImvJkjBc91fxYW7nUDQV30\nbjCU03RGyhOsXP6qOOIF3uEao8fLgCzchG/uwpN80K6UC0E+buFtTMF2sItl\nKFvPMkRYjkdWiWNtTcAS4iUbdRq9UhWb8F/M+cI8g7gw9TBUOCo6VWPRHi8T\nwDOukWr1h2gQ+oIJLrVkNXBm45XV6LUopJqYau/BKsfhBWM+21IgF/F/C9/U\nO7Or\r\n=aKSu\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIDJ7Gm9k1JD9/haCS6vM+K0ksReo0B13Fctgto+K6yloAiBxUFtaX9WGzZCLSkLJu+gfVVIKWfQYLbGe/Fuc9RtrTg=="}],"size":2710,"noattachment":false,"key":"/@solid-primitives/utils/-/@solid-primitives/utils-0.0.200.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.200_1638140664139_0.7309394422457578"},"_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":1638140664293,"_cnpm_publish_time":1638140664293,"dist-tags":{"beta":"5.4.0-beta.0","latest":"7.0.1","next":"7.0.0-next.8"}}