{"name":"@solid-primitives/utils","version":"1.2.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"},"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","main":"dist/index.cjs","module":"dist/index.js","types":"dist/index.d.ts","scripts":{"build":"tsup","test":"uvu -r solid-register","watch-test":"watchlist src test -- npm test"},"keywords":["utilities","reactivity","solid","primitives"],"devDependencies":{"jsdom":"^19.0.0","prettier":"^2.5.1","solid-register":"^0.1.5","tslib":"^2.3.1","tsup":"^5.11.0","uvu":"^0.5.2","watchlist":"^0.3.1"},"peerDependencies":{"solid-js":"^1.3.1"},"gitHead":"762513eaec12f932c499e1cc9211620e25daec9c","_id":"@solid-primitives/utils@1.2.0","_nodeVersion":"16.13.2","_npmVersion":"8.5.3","dist":{"integrity":"sha512-R2hZiB3xv24OMZymHmPyRseLRceUFF2iRZjA/9jr2ioqvZi1WNrW/aUor6mNIBf7r/QyiZpr2ByszQKFvhym5g==","shasum":"99a1f4661804fa834a6513661ee97d432497cb8d","tarball":"http://registry-npm.ywwl.com/@solid-primitives/utils/download/@solid-primitives/utils-1.2.0.tgz","fileCount":6,"unpackedSize":20736,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQD5uT7UBh0Tcsft+IEGJ0HNMQ44cm0BwSsQ7c5tA6qyFgIgRNnCxadFdFR21EZPatYT7/KmoHChgfrxCWA+M8fa6DQ="}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJiX9p8ACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmoFBBAAhOInUfEdC2g8mZ7+U8w8PfT4kN1f6YbWNbFf1sKyCVlnXrAS\r\n1EI5PwshaoXjGeU8RVm8KT3BShE/kzvZm4cAp+2on+J/qYAQz6OGzk22RMGk\r\niTEBsqvALSCPH3/eaq8EYc9joIFba+F3sMLRGIWtrHktXOzopRFECD/iFD8S\r\ndQt8RIcVH+7D1AXLGXb0YlFbPZ45JoYL6NBm0tL2RehblhBAwhfe9Jg7JIVe\r\nBfKrBdwTXblC8zn5G0I2ZmuQ/Ahwp/U6iLzo7gm069AN+HJhLpxt1W0O8FN7\r\nJYvDDMCEoo07Xdstt9IIYp8UpmPrrij1nbdTIySHGU23lM+0v8EIyPrItrBz\r\nppKswWb51T6jdw4OQGqF1ds3je7L3QBDQtGPRbqPKJntZr5vENr7yQX5RCJy\r\nOIH2a+SFJlAEqJMA4/qfbllph/hCMx+7Fww7YptlIHVNl9vCob6Hw61Q7dgs\r\njRQW9hQzVJE1pSXhJEdwUs9sNkqgPZJ+F5fTlgBTkqPL7UKfxwhFRoZALyJe\r\nep5HxVvv6vQNshFXUSqP8lRSLlMJ4rQlip6uy/ziKr6xh1CJ+kFjVe6aSQpY\r\nzHY/XrmoTA87JaoZBKDlMbLLmMPb3bgwuu9dagyPMYNNoR90ofYFnMiDJt8g\r\nbBfPhdajs6dAqCp6kwfTWPm6AMoxn/gG33M=\r\n=BvK8\r\n-----END PGP SIGNATURE-----\r\n","size":6452,"noattachment":false,"key":"/@solid-primitives/utils/-/@solid-primitives/utils-1.2.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/utils_1.2.0_1650449020341_0.21634914158883745"},"_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":1650449020531,"_cnpm_publish_time":1650449020531,"dist-tags":{"beta":"5.4.0-beta.0","latest":"7.0.1","next":"7.0.0-next.8"}}