{"id":32241607,"url":"https://github.com/mkuklis/depot.js","last_synced_at":"2026-02-21T12:02:26.577Z","repository":{"id":6857417,"uuid":"8106234","full_name":"mkuklis/depot.js","owner":"mkuklis","description":"📦 depot.js is a storage library with a simple API","archived":false,"fork":false,"pushed_at":"2023-01-07T03:56:12.000Z","size":1342,"stargazers_count":245,"open_issues_count":6,"forks_count":16,"subscribers_count":18,"default_branch":"master","last_synced_at":"2026-01-24T07:44:29.583Z","etag":null,"topics":["javascript","localstorage","serialization","storage","store"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","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/mkuklis.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","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":"2013-02-09T04:48:09.000Z","updated_at":"2025-06-23T14:16:11.000Z","dependencies_parsed_at":"2023-01-13T14:08:05.315Z","dependency_job_id":null,"html_url":"https://github.com/mkuklis/depot.js","commit_stats":null,"previous_names":[],"tags_count":9,"template":false,"template_full_name":null,"purl":"pkg:github/mkuklis/depot.js","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mkuklis%2Fdepot.js","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mkuklis%2Fdepot.js/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mkuklis%2Fdepot.js/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mkuklis%2Fdepot.js/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mkuklis","download_url":"https://codeload.github.com/mkuklis/depot.js/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mkuklis%2Fdepot.js/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29680147,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-21T11:29:27.227Z","status":"ssl_error","status_checked_at":"2026-02-21T11:29:20.292Z","response_time":107,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["javascript","localstorage","serialization","storage","store"],"created_at":"2025-10-22T15:43:20.723Z","updated_at":"2026-02-21T12:02:26.570Z","avatar_url":"https://github.com/mkuklis.png","language":"JavaScript","readme":"## 📦 depot.js\n\n[![build status](https://secure.travis-ci.org/mkuklis/depot.js.png)](http://travis-ci.org/mkuklis/depot.js)\n\n## Description\n\n**depot.js** is a namespaced [localStorage](http://diveintohtml5.info/storage.html) wrapper with a simple API.\nThere are [other](http://brian.io/lawnchair/) [tools](https://github.com/marcuswestin/store.js/) out there but none\nof them had what I was looking for.\n\n## Setup\n\nYou can install depot.js via npm:\n\n```js\n  npm install depotjs --save\n```\n\nor load it directly via `\u003cscript src=\"depot.browser.js\"\u003e\u003c/script\u003e`. The `dist` folder contains the most recent minified browser version `depot.browser.js`.\n\n## Dependencies\n\ndepot.js does not depend on any other libraries however if you plan to support older browsers you will need to include [ES5-shim](https://github.com/kriskowal/es5-shim).\n\nIf you plan to run it on browsers that don't support [localStorage](http://diveintohtml5.info/storage.html) you may try to include [storage polyfill](https://gist.github.com/remy/350433).\n\n## API\n\n+ save(record)\n\n+ saveAll(array)\n\n+ updateAll(hash)\n\n+ update(hash)\n\n+ find(hash | function)\n\n+ all()\n\n+ destroy(id | record)\n\n+ destroyAll(none | hash | function)\n\n+ get(id)\n\n+ size()\n\n## Usage\n\n#### Import depot\n\n```js\nimport depot from 'depotjs';\n```\n\n#### Define new store\n\n```js\nconst todos = depot('todos');\n```\n\n#### Add new records\n\n`_id` property will be generated as GUID and attached to each new record:\n\n```js\ntodos.save({ title: \"todo1\" });\ntodos.save({ title: \"todo2\", completed: true });\ntodos.save({ title: \"todo3\", completed: true });\n```\n\n#### Add multiple records at once\n\n```js\ntodos.saveAll([ { title: \"todo1\" }, { title: \"todo2\" }, { title: \"todo3\" } ]);\n```\n\n#### Update all records\n\n```js\ntodos.updateAll({ completed: false });\n```\n\n#### Return all records\n\n```js\ntodos.all(); // [{ _id: 1, title \"todo1\" }, { _id: 2, title: todo2 }]\n```\n\n#### Find records\n\n* find based on given criteria\n\n```js\ntodos.find({ completed: true }); // [{ _id: 2, title: \"todo2\" }, { _id: 3, title: \"todo3\" }]\n```\n\n* find based on given function\n\n```js\ntodos.find(record =\u003e record.completed \u0026\u0026 record.title == \"todo3\"); // [{ _id: 3, title: \"todo3\" }]\n```\n\n\n#### Return single record by id\n\n```js\ntodos.get(1); // { _id: 1, title: \"todo1\" }\n```\n\n#### Destroy single record\n\n* by record id\n\n```js\ntodos.destroy(1);\n```\n\n* by record object\n\n```js\ntodos.destroy(todo);\n```\n\n#### Destroy all records\n\n* destroy all\n\n```js\ntodos.destroyAll();\n```\n\n* destroy by given criteria\n\n```js\ntodos.destroyAll({ completed: true });\n```\n\n* destroy by given function\n\n```js\ntodos.destroyAll(record =\u003e record.completed \u0026\u0026 record.title === \"todo3\");\n```\n\n## Options\n\nYou can pass a second parameter to `depot` with additional options.\n\n```js\nconst todos = depot(\"todos\", options);\n```\n\n### Available options:\n\n+ idAttribute - used to override record id property (default: `_id`)\n\n```js\nconst todos = depot(\"todos\", { idAttribute: 'id' });\n```\n\n+ storageAdaptor - used to override storage type (default: `localStorage`)\n\n```js\nconst todos = depot('todos', { storageAdaptor: sessionStorage });\n```\n\n\n## License:\n\u003cpre\u003e\nThe MIT License\n\u003c/pre\u003e\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmkuklis%2Fdepot.js","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmkuklis%2Fdepot.js","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmkuklis%2Fdepot.js/lists"}