{"id":23084144,"url":"https://github.com/localforage/localforage-setitems","last_synced_at":"2025-08-16T01:31:59.627Z","repository":{"id":32020091,"uuid":"35591288","full_name":"localForage/localForage-setItems","owner":"localForage","description":"Adds setItems method to localForage.","archived":false,"fork":false,"pushed_at":"2018-11-05T20:59:57.000Z","size":32,"stargazers_count":19,"open_issues_count":0,"forks_count":5,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-12-08T23:43:41.533Z","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":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/localForage.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-05-14T04:46:28.000Z","updated_at":"2023-12-19T08:49:12.000Z","dependencies_parsed_at":"2022-08-31T03:01:28.403Z","dependency_job_id":null,"html_url":"https://github.com/localForage/localForage-setItems","commit_stats":null,"previous_names":["thgreasi/localforage-setitems"],"tags_count":7,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/localForage%2FlocalForage-setItems","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/localForage%2FlocalForage-setItems/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/localForage%2FlocalForage-setItems/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/localForage%2FlocalForage-setItems/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/localForage","download_url":"https://codeload.github.com/localForage/localForage-setItems/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":229988092,"owners_count":18155680,"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-12-16T15:49:15.487Z","updated_at":"2024-12-16T15:49:16.132Z","avatar_url":"https://github.com/localForage.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"localForage-setItems\n====================\n[![npm](https://img.shields.io/npm/dm/localforage-setitems.svg)](https://www.npmjs.com/package/localforage-setitems)  \nAdds setItems method to [localForage](https://github.com/mozilla/localForage).\n\n## Requirements\n\n* [localForage](https://github.com/mozilla/localForage) v1.4.0+\n  * for earlier versions of localforage, please use the v1.1.x releases\n\n## Installation\n`npm i localforage-setitems`\n\n## Importing\n\n### TypeScript\n\n[Include `localforage` with an import statement appropriate for your configuration](https://github.com/localForage/localForage/blob/master/README.md#typescript) and import `localforage-setitems` right after it.\n\nNormally, `localforage-setitems` will extend the prototype of `locaforage` to include the `setItems()` method, but unfortunately the typings can't be updated.\nAs a result you should use the exported `extendPrototype()` method, which returns the provided localforage instance but with inherited typings that also include the `setItems()` method.\n\n```javascript\nimport localForage from 'localforage';\n// OR based on your configuration:\n// import * as localForage from 'localforage';\n\nimport { extendPrototype } from 'localforage-setitems';\n\nextendPrototype(localforage);\n\n// Keep using localForage as usual.\n```\n\n### Known issues with module bundlers\n\nIn some ES6 module bundlers `.setItems()` might not automatically be made available to the `localforage` object on import.\nIn this case, import the provided `extendPrototype()` method and extend `localforage` manually, as shown in the Typescript section.\n\n## jsperf links\n* [default driver order (indexedDB prefered)](https://jsperf.com/localforage-setitems-2017/1)\n* [websql (not for firefox)](https://jsperf.com/localforage-setitems-websql-2017b/1)\n\n## API\nYou can pass an array with the key-value pairs:\n```js\nvar items = [\n  { key: 'asdf', value: 'asdf value!' },\n  { key: 'asap', value: 'asap value!' },\n  { key: 'async', value: 'async value!' }\n];\nlocalforage.setItems(items);\n```\n\nOr you can pass a object with the keys as properties:\n```js\nvar items = {\n  asdf: 'asdf value!',\n  asap: 'asap value!',\n  async: 'async value!'\n};\nlocalforage.setItems(items);\n```\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flocalforage%2Flocalforage-setitems","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flocalforage%2Flocalforage-setitems","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flocalforage%2Flocalforage-setitems/lists"}