{"id":15637509,"url":"https://github.com/linusu/fanny-pack","last_synced_at":"2025-04-14T06:50:46.457Z","repository":{"id":57112558,"uuid":"140551054","full_name":"LinusU/fanny-pack","owner":"LinusU","description":"🗄 Fanny Pack is a non-fancy, but very practical, key/value-store","archived":false,"fork":false,"pushed_at":"2018-09-20T14:06:26.000Z","size":64,"stargazers_count":106,"open_issues_count":1,"forks_count":7,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-03-27T20:39:16.566Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/LinusU.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-07-11T09:15:40.000Z","updated_at":"2024-02-08T19:54:56.000Z","dependencies_parsed_at":"2022-08-21T10:00:13.593Z","dependency_job_id":null,"html_url":"https://github.com/LinusU/fanny-pack","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LinusU%2Ffanny-pack","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LinusU%2Ffanny-pack/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LinusU%2Ffanny-pack/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LinusU%2Ffanny-pack/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/LinusU","download_url":"https://codeload.github.com/LinusU/fanny-pack/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248837274,"owners_count":21169373,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-03T11:11:57.415Z","updated_at":"2025-04-14T06:50:46.428Z","avatar_url":"https://github.com/LinusU.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Fanny Pack\n\nFanny Pack is a non-fancy, but very practical, key/value-store.\n\n- ✅ First class support for multiple platforms\n- ✅ Very simple, low-level API\n- ✅ Easy to get started with\n- ✅ Uses promises and async iterators\n\n## Platforms\n\n- [`@fanny-pack/browser`](https://github.com/LinusU/fanny-pack/tree/master/packages/browser)\n- [`@fanny-pack/browser-extension`](https://github.com/LinusU/fanny-pack/tree/master/packages/browser-extension)\n- [`@fanny-pack/memory`](https://github.com/LinusU/fanny-pack/tree/master/packages/memory)\n- [`@fanny-pack/node`](https://github.com/LinusU/fanny-pack/tree/master/packages/node)\n- [`@fanny-pack/react-native`](https://github.com/LinusU/fanny-pack/tree/master/packages/react-native)\n\n## Usage\n\n```js\nconst FannyPack = require('@fanny-pack/memory')\n\nconst fp = new FannyPack()\n\n/*** Set Values ***/\nawait fp.set('b', 'World')\nawait fp.set('a', 'Hello')\nawait fp.set('c', 'Linus')\n\n/*** Get Values ***/\nconsole.log(await fp.get('c'))\n//=\u003e 'Linus'\n\nconsole.log(await fp.get('d'))\n//=\u003e undefined\n\n/*** Check Presence ***/\nconsole.log(await fp.has('c'))\n//=\u003e true\n\nconsole.log(await fp.has('d'))\n//=\u003e false\n\n/*** Iterate Content ***/\nfor await (const key of fp.keys()) {\n  console.log(key)\n}\n//=\u003e 'a', 'b', 'c'\n\nfor await (const value of fp.values({ lt: 'c' })) {\n  console.log(value)\n}\n//=\u003e 'Hello', 'World'\n\nfor await (const key of fp.keys({ gt: 'a', lte: 'c' })) {\n  console.log(key)\n}\n//=\u003e 'b', 'c'\n```\n\n## API\n\n### `.clear(): Promise\u003cvoid\u003e`\n\nRemove all entries from the Fanny Pack.\n\n### `.delete(key: string): Promise\u003cvoid\u003e`\n\nRemove a specific entry. If no entry with the given key exists, then this is a no-op.\n\n### `.get(key: string): Promise\u003cJSONValue | undefined\u003e`\n\nReturn the value of a specific entry. If no entry with the given key exists, `undefined` will be returned.\n\n### `.has (key: string): Promise\u003cboolean\u003e`\n\nCheck wether or not an entry with the given key exists.\n\n### `.set (key: string, value: JSONValue): Promise\u003cvoid\u003e`\n\nAdd or update a specific entry.\n\n### `KeyRange`\n\nAn object containing any or none of the following properties:\n\n- `gt` (greater than), `gte` (greater than or equal) define the lower bound of the entries to be fetched and will determine the starting point. Only entries where the key is greater than (or equal to) this option will be included in the range.\n\n- `lt` (less than), `lte` (less than or equal) define the higher bound of the range to be fetched. Only entries where the key is less than (or equal to) this option will be included in the range.\n\n### `.keys(range?: KeyRange): AsyncIterableIterator\u003cstring\u003e`\n\nReturns an asynchrounous iterator over the keys in the Fanny Pack. Specify a `range` to limit which entries to include.\n\n### `.values(range?: KeyRange): AsyncIterableIterator\u003cJSONValue\u003e`\n\nReturns an asynchrounous iterator over the values in the Fanny Pack. Specify a `range` to limit which entries to include.\n\n### `.entries(range?: KeyRange): AsyncIterableIterator\u003c[string, JSONValue]\u003e`\n\nReturns an asynchrounous iterator over the entries in the Fanny Pack. Specify a `range` to limit which entries to include.\n\n## Accepting Fanny Packs\n\nIf you have a library that needs to store stuff, accepting a Fanny Pack is the perfect way to do it. That way your library can stay platform independent, and your users can store their data in one place.\n\nAll Fanny Packs are versioned and released at the same time. To declare what version your library is compatible with, declare a `peerDependency` on `@fanny-pack/core`. All Fanny Pack implementations depend on that package, and thus any Fanny Pack the user depends on will have to fall in that range.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flinusu%2Ffanny-pack","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flinusu%2Ffanny-pack","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flinusu%2Ffanny-pack/lists"}