{"id":15662352,"url":"https://github.com/yields/dex","last_synced_at":"2025-10-10T08:35:10.839Z","repository":{"id":11593702,"uuid":"14084965","full_name":"yields/dex","owner":"yields","description":"Lightweight IndexedDB wrapper","archived":false,"fork":false,"pushed_at":"2014-01-07T01:24:28.000Z","size":329,"stargazers_count":18,"open_issues_count":3,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-10-10T08:34:07.645Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/yields.png","metadata":{"files":{"readme":"Readme.md","changelog":"History.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-11-03T12:25:22.000Z","updated_at":"2023-08-27T04:04:47.000Z","dependencies_parsed_at":"2022-09-19T11:40:29.377Z","dependency_job_id":null,"html_url":"https://github.com/yields/dex","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/yields/dex","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yields%2Fdex","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yields%2Fdex/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yields%2Fdex/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yields%2Fdex/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/yields","download_url":"https://codeload.github.com/yields/dex/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yields%2Fdex/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279003296,"owners_count":26083555,"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","status":"online","status_checked_at":"2025-10-10T02:00:06.843Z","response_time":62,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":[],"created_at":"2024-10-03T13:32:02.353Z","updated_at":"2025-10-10T08:35:10.822Z","avatar_url":"https://github.com/yields.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![Build Status](https://travis-ci.org/yields/dex.png?branch=master)](https://travis-ci.org/yields/dex)\n\n# dex\n\n  Lightweight IndexedDB wrapper\n\n```js\nvar dex = require('dex')();\n\n// set\ndex\n  .set('foo', 'baz')\n  .set('baz', 'foo')\n  .end(function(err, all){});\n\n// get\ndex\n  .get('foo')\n  .get('baz')\n  .end(function(err, all){\n    assert('baz' == all.shift().item.value);\n    assert('foo' == all.shift().item.value);\n  });\n\n// del\ndex\n  .del('foo')\n  .del('baz')\n  .end(function(err, all){});\n\n// exists\ndex\n  .exists('foo')\n  .exists('baz')\n  .end(function(err, bools){});\n```\n\n## Installation\n\n  Install with [component(1)](http://component.io):\n\n    $ component install yields/dex\n\n## API\n\n### events\n\n  - `(\"connect\", event)`\n  - `(\"abort\", event)`, emitted when a transaction is aborted\n  - `(\"complete\", event)`, emitted when a transaction is completed\n  - `(\"progress\", event)`, emitted on transaction progress\n  - `(\"set\", key, value)`, emitted when `key`, `value` are saved.\n  - `(\"del\", key)`, emitted when a `key` is deleted.\n\n### dex#command\n\n  `command(name, fn)` is a static method that allows you\n  to define new commands easily.\n\n  all `dex()` commands are defined using this method, see examples in [`lib/commands.js`](lib/commands.js)\n\n### dex()\n\n  Create a new `Database` instance.\n\n#### #connect\n\n  The method is called automatically, you don't need to call\n  it unless you `quit()`.\n\n#### #quit\n\n  Disconnect\n\n#### #set\n\n  Set `key`, `value` with optional `fn(err, o)`\n\n#### #get\n\n  Get `key`'s `value`.\n\n#### #exists\n\n  Determine if a `key` exists.\n\n#### #del\n\n  Delete `key`\n\n#### #keys\n\n  Get all `keys` that match a `regexp`\n\n```js\ndex().keys(/a/, function(err, keys){});\n```\n\n#### #abort\n\n  Abort all running transactions.\n\n```js\nvar d = dex();\nvar i = 0;\nd.set('multi', 1);\nd.set(1, 1);\nd.set(2, 2);\nd.set(3, 3);\nd.get(3);\nd.set(4, 4);\n\nd.on('progress', function(e){\n  if (1 == i++) d.abort();\n});\n\nd.end(function(err){\n  assert(err);\n  d.get('multi', function(err, o){\n    if (err) return done(err);\n    assert(!o.item);\n  });\n});\n```\n\n#### #end\n\n  Invoke the transaction.\n\n```js\ndex()\n.set('foo', 'baz')\n.set('baz', 'foo')\n.set('more', { stuff: [] })\n.end(function(err, all){});\n```\n\n  under the hood dex will create a single transaction of `readwrite`.\n\n```js\ndex()\n.get('foo')\n.get('baz')\n.get('more')\n.end(function(err, all){});\n```\n\n  in the above snippet `dex()` will create a single `readonly` transaction.\n\n```js\ndex()\n.set('foo', 'foo')\n.get('foo')\n.set('baz', 'foo')\n.set('some', 'stuff')\n.del('foo')\n.end(function(err, all){});\n```\n\n  two transactions will be created `readwrite` and `readonly`.\n\n## Tests\n\n```bash\n$ make test\n```\n\n## License\n\n  MIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyields%2Fdex","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fyields%2Fdex","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyields%2Fdex/lists"}