{"_id":"@astrocloudllc/fridge","_rev":"4-127570f84e639e97ca05f058d8835854","name":"@astrocloudllc/fridge","dist-tags":{"latest":"1.0.3"},"versions":{"1.0.0":{"name":"@astrocloudllc/fridge","version":"1.0.0","license":"MIT","_id":"@astrocloudllc/fridge@1.0.0","maintainers":[{"name":"aaroningalls","email":"aaroningalls@hotmail.com"}],"dist":{"shasum":"f099aca888c7f6be6291b2face41c120e37e35ef","tarball":"https://registry.npmjs.org/@astrocloudllc/fridge/-/fridge-1.0.0.tgz","fileCount":6,"integrity":"sha512-ymP/5UI5rkVY6fuYYRcNcJFqhNEmBnCCLJfK3nxNVd1HnPxHIVmtf2+z/Fv4D+edS6msWEbfL3CuAiX2T/0AsA==","signatures":[{"sig":"MEYCIQCY0Ulfuzf11ZzUAHwddDfRQSipKHXqHS9A4vhcFC/lLAIhAK89WYrgNcSN55xALuU+ci8/3ABE396si9lKjz115oXG","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":28611,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJkIJ3WACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmqPCA/+N1EuT+XHybdnLpDP7sgzw9WO1uIEJgJjFr/4QiSzz/gWpfLH\r\nGQb12KZMETQGoXWLERxmkGeZiEMwAds66xR7ReOPr3ThFv4QNu5QZ2OkEEmR\r\nOza/xgqYhGuZOIU/qVf5HJXQpUSB+VLYcYe94V4t9EJw0vp4Uebzmavc7/S4\r\n531SbTml3twIKTFmt9mt+Iu5FXVZH/D0lB35OelB8jiPRboDRqKWTMRtz34X\r\nRE6HyVA2F+gHXrTNPneQwBey4lvw3GPV0AQOoXV/sDOnF07qFGN+JUwEv9nZ\r\nED53SJaYSD5+Y+ej5PoBzGSvkLknpSCmgVaXZkXOzhVQoHbgc/eMvxGCZD9E\r\nYtY4dqt/wMdnJ0y2z43EK63D8bFON7r7h8y/US9A7xuppohuY37p0axUjsAN\r\n1dAg2o8qJodz0eFgWFZg+pbIiAVy6UZpE12mXzeipTwODndWRQtDAfNaKrCM\r\nkrJvC2qoDyNSM/BvLHmW1mvWTn0hBhnf7orhosUCB1puT1nd9chMHjEbCk20\r\nh3CDYcWmMmnApeacvtaonvt4L7/+oSTIfrl+MhxDRXIkn1bJsYrTSdVV4w6n\r\nwPIR8733B6+GiON+uhhrz77xdz2Py6aqRosjT6VP4AbyVfV5cWLnWD3c2Ahd\r\nB0iEB+GkvRYn9oISvQRgWADripAexmzUEO0=\r\n=ln1T\r\n-----END PGP SIGNATURE-----\r\n"},"main":"dist/index.js","type":"module","types":"dist/index.d.ts","gitHead":"22574c1e793a86c93d10b2a738f8f8319cf82f4f","scripts":{"build":"npx rollup -c rollup.config.js"},"_npmUser":{"name":"aaroningalls","email":"aaroningalls@hotmail.com"},"_npmVersion":"9.3.1","description":"A TypeScript wrapper around @react-native-async-storage/async-storage that can be used to simplify working with local storage.","directories":{},"_nodeVersion":"18.14.0","_hasShrinkwrap":false,"devDependencies":{"typescript":"^5.0.2","rollup-plugin-dts":"^5.3.0","@rollup/plugin-typescript":"^11.0.0"},"peerDependencies":{"@react-native-async-storage/async-storage":"^1.17.12"},"_npmOperationalInternal":{"tmp":"tmp/fridge_1.0.0_1679859158259_0.6729111987611596","host":"s3://npm-registry-packages"}},"1.0.1":{"name":"@astrocloudllc/fridge","version":"1.0.1","keywords":["react-native","react native","storage","async storage","asyncstorage","typescript"],"author":{"name":"Aaron Ingalls"},"license":"MIT","_id":"@astrocloudllc/fridge@1.0.1","maintainers":[{"name":"aaroningalls","email":"aaroningalls@hotmail.com"}],"homepage":"https://github.com/astrocloudllc/fridge","bugs":{"url":"https://github.com/astrocloudllc/fridge/issues"},"dist":{"shasum":"49ea9a2c820c245276b9d1bb3717d0b661c949af","tarball":"https://registry.npmjs.org/@astrocloudllc/fridge/-/fridge-1.0.1.tgz","fileCount":6,"integrity":"sha512-w2AzjC/QPT9nGSQm3wZ77zGT1j4O24Rl+XqYh4jCaA8sENxmoLuZtbVAIdAwdT6/X7Vtbj774dpiCRP+44z97g==","signatures":[{"sig":"MEUCIGfu4el+XpU3WDynJsEWo6wCBNrMEB019yz56MODuzCgAiEA1afLNQfQ2wQAn4x6ZRRJphp1EjdnsqxXw6h/DCoAVcU=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":32460,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJkIK05ACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmqegA/9GFmIpKo0iPGAPsH8RagdmFTe6duxRkqfkFQNZjwKqsAgk7+V\r\nklkz7VI0uy3prgKW+BsZMlznmNCK23WVmhmnzpH87Mnv9IFf11Zydb7a9tnP\r\n6DZnRT1DYb7QFM91XHFTFy65qeSy1RhB1iyACv1nsMOv1W8Sk80KYO0GzVw7\r\nAmvP7Ub8+okX1O4xDzyCkkP5ICkDBIbRHtgixHlHtqsKbWR4n62u5u3Ta1Ct\r\nrA58r3r5gMvaswCP6Y4Fii19WMrOvZ8yaNjBz75QgQ9jEsnMa120oIyHBx74\r\nRAb6hS5E2fkNPxiPRfZn/T4HXL6wAPwTIr3dUocNuLOC30ZTON9ePeqXnDSc\r\nyaicNAZMXHynBVDuK/Lwf+YEnNzMsr/WAnGA3Gy0mLy78Z5Fc37GeC9JI27K\r\nSgdxsW5vxEtD2ON+Ps+Dq1IUCh1QszahFnsOWUH28/vDPXYTzGXQXZofUQB4\r\nK7FrarxTREL33VFxBVIWvTf7Pb7fYbOOFXqBY43+3RQRe5UaT2VooZkGP7AG\r\nHkEu7nP9Fjcl4dS51FXNNiDbv1ek9ogPBkew9ckEkFDwDeJG1cpDldS4UYi4\r\nRmte1oQ2m0WPOVlBI0GdKgQCBnVh76WeUdQhv+NUdBa1k8WYqIv7fQuRk27d\r\nWwGwQwIYpn+TwPV7FFhkHRC5xvE0Ri0bGIg=\r\n=RMN0\r\n-----END PGP SIGNATURE-----\r\n"},"main":"dist/index.js","type":"module","types":"dist/index.d.ts","gitHead":"9ae98bfe0484b4ba24a0c5da72f0aab5c48e5cf6","scripts":{"build":"npx rollup -c rollup.config.js"},"_npmUser":{"name":"aaroningalls","email":"aaroningalls@hotmail.com"},"repository":{"url":"git+https://github.com/astrocloudllc/fridge.git","type":"git"},"_npmVersion":"9.3.1","description":"A TypeScript wrapper around react-native-async-storage. This package provides full types for all of your data to make working with AsyncStorage simpler.","directories":{},"_nodeVersion":"18.14.0","_hasShrinkwrap":false,"devDependencies":{"typescript":"^5.0.2","rollup-plugin-dts":"^5.3.0","@rollup/plugin-typescript":"^11.0.0"},"peerDependencies":{"@react-native-async-storage/async-storage":"^1.17.12"},"_npmOperationalInternal":{"tmp":"tmp/fridge_1.0.1_1679863097030_0.10904823304302003","host":"s3://npm-registry-packages"}},"1.0.3":{"name":"@astrocloudllc/fridge","version":"1.0.3","main":"dist/index.js","types":"dist/index.d.ts","license":"MIT","type":"module","description":"A TypeScript wrapper around react-native-async-storage. This package provides full types for all of your data to make working with AsyncStorage simpler.","keywords":["react-native","react native","storage","async storage","asyncstorage","typescript"],"homepage":"https://github.com/astrocloudllc/fridge","repository":{"type":"git","url":"git+https://github.com/astrocloudllc/fridge.git"},"author":{"name":"Aaron Ingalls"},"scripts":{"build":"npx rollup -c rollup.config.js"},"peerDependencies":{"@react-native-async-storage/async-storage":"^2.1.0"},"devDependencies":{"@rollup/plugin-typescript":"^11.1.6","rollup-plugin-dts":"^5.3.1","typescript":"^5.0.2"},"_id":"@astrocloudllc/fridge@1.0.3","gitHead":"b05cf70d758bdafa6e3a2cfffa9e96413c6f77af","bugs":{"url":"https://github.com/astrocloudllc/fridge/issues"},"_nodeVersion":"20.10.0","_npmVersion":"10.2.3","dist":{"integrity":"sha512-8Q9W+YZS8xT+l1tX+lIgzoiozA4FXj+t9EjmxZFYo4v+RJhAa576xhmzX7xYJmETffdujqlqi6T+Cv4HdyBdIw==","shasum":"8aec1540e02aee9a4b740770e5b0256d030a7422","tarball":"https://registry.npmjs.org/@astrocloudllc/fridge/-/fridge-1.0.3.tgz","fileCount":6,"unpackedSize":31341,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIAj1uFtN5bsNIEdCPzdcTYqEU0LvNvK1UMAucO6rjUdFAiBD32Ipk2RCv23lTcCs7q3atInEWTs6PhrA6o54I/V85w=="}]},"_npmUser":{"name":"aaroningalls","email":"aaroningalls@hotmail.com"},"directories":{},"maintainers":[{"name":"aaroningalls","email":"aaroningalls@hotmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/fridge_1.0.3_1736116753547_0.5227127656827528"},"_hasShrinkwrap":false}},"time":{"created":"2023-03-26T19:32:38.205Z","modified":"2025-01-05T22:39:13.941Z","1.0.0":"2023-03-26T19:32:38.446Z","1.0.1":"2023-03-26T20:38:17.262Z","1.0.2":"2025-01-05T22:23:18.044Z","1.0.3":"2025-01-05T22:39:13.734Z"},"bugs":{"url":"https://github.com/astrocloudllc/fridge/issues"},"author":{"name":"Aaron Ingalls"},"license":"MIT","homepage":"https://github.com/astrocloudllc/fridge","keywords":["react-native","react native","storage","async storage","asyncstorage","typescript"],"repository":{"type":"git","url":"git+https://github.com/astrocloudllc/fridge.git"},"description":"A TypeScript wrapper around react-native-async-storage. This package provides full types for all of your data to make working with AsyncStorage simpler.","maintainers":[{"name":"aaroningalls","email":"aaroningalls@hotmail.com"}],"readme":"# fridge\nA TypeScript wrapper around [@react-native-async-storage/async-storage](https://github.com/react-native-async-storage/async-storage) that can be used to simplify working with local storage.\n\n## Install\n\n```\nnpm install @react-native-async-storage/async-storage @astrocloudllc/fridge\n```\nor \n```\nyarn add @react-native-async-storage/async-storage @astrocloud/fridge\n```\n\n## Setup\nThe easiest way to use this package is to create a file that handles your storage types and exports the types and storage object. For example, create a file called `storage.ts` and add the following:\n```ts\nimport { createStorage } from \"@astrocloudllc/fridge\"\n\nexport interface StorageTypes {\n  /* Your types go here */\n}\n\nexport const storage = createStorage<StorageTypes>()\n```\nThen import the storage object in any file where you need to interact with AsyncStorage.\n\n## Functions\nFridge includes several function, most of which directly run the relevant AsyncStorage function. Most of these function handle parsing and stringifying objects to simplify code used in other places.\n\n### Getting Items\n\n**`getItem`**\n\nRetrieves an item from AsyncStorage and returns it as a parsed object. If the key is null the promise rejects\n```ts\nstorage.getItem(\"key\").then((data) => {\n  //do stuff\n}).catch((e) => {\n  // key is null\n})\n```\n\n**`getNullableItem`**\n\nSimilar to `getItem`, but instead of rejecting on `null` the promise resolves, similar to AsyncStorage's implementation.\n\n```ts\nstorage.getNullableItem(\"key\").then((data) => {\n  // data is an object or null\n})\n```\n**`getKey`**\n\nBehaves identically to `AsyncStorage.getItem()` with no type checking or parsing.\n\n```ts\nstorage.getKey(\"key\").then((data) => {\n  // data is a string or null\n})\n```\n\n**`multiGet`**\n\nRetrives multiple keys at once. The return type is different from `AsyncStorage.multiGet()`. Instead of two arrays this function returns an object where each key's value is the data found at that key.\n\n```ts\ninterface StorageKeys {\n  thing1: string[];\n  thing2: number[];\n}\n\nstorage.multiGet([\"thing1\", \"thing2\"]).then((data) => {\n  data.thing1 // string[]\n  data.thing2 // number[]\n})\n```\n\n**`getAllKeys`**\n\nGet an array of all keys in storage\n\n```ts\nstorage.getAllKeys().then((data) => {\n  //do stuff\n})\n```\n\n\n\n### Setting Items\n\n**`setItem`**\n\nSets an item to storage.\n```ts\nstorage.setItem(\"key\", data).then(() => {\n  // do stuff\n})\n```\n\n**`setKey`**\n\nBehaves identically to `AsyncStorage.setItem()` with no type checking or parsing.\n\n**`multiSet`**\n\nSet multiple keys at once. Accpets an object that is similar to what is returned from `multiGet`\n\n```ts\nstorage.multiSet({\n  thing1: [\"a\", \"b\", \"c\"],\n  thing2: [1, 2, 3]\n}).then(() => {\n  // do stuff\n})\n```\n\n### Removing Items\n\n**`removeItem`**\n\nRemove an item from storage\n\n```ts\nstorage.removeItem(\"key\")\n```\n\n**removeKey**\nRemove any key from storage, avoiding type checking on all defined keys.\n\n**`multiRemove`**\n\nRemove multiple items from storage.\n\n```ts\nstorage.multiRemove([\n  \"thing1\",\n  \"thing2\"\n])\n```\n\n**`clear`**\n\nClear all keys from storage.\n\n```ts\nstorage.clear()\n```\n\n## FAQ\n**Does this work with Expo?**\n\nYes! No extra setup is required, just install the package and use it as normal.\n\n**Why is it called `fridge`?**\n\nIn theory it's cause refrigerators store things in a fairly organized manner. In reality it's cause naming stuff is hard so I just picked a thing.\n\n## Contributing\n\nPull requests are welcome if there are any changes you think would be beneficial or if there is a bug.\n\n\n\n\n","readmeFilename":"README.md"}