{"id":16747176,"url":"https://github.com/selfup/lspi","last_synced_at":"2025-04-10T13:43:44.677Z","repository":{"id":9255407,"uuid":"61409493","full_name":"selfup/lspi","owner":"selfup","description":"ORM for local storage that can save you time!","archived":false,"fork":false,"pushed_at":"2023-10-24T04:05:01.000Z","size":1256,"stargazers_count":6,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-04-13T21:56:35.937Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/selfup.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2016-06-18T00:24:06.000Z","updated_at":"2024-06-19T10:33:43.711Z","dependencies_parsed_at":"2023-01-11T17:34:35.362Z","dependency_job_id":"cff55695-ad87-42fc-9d83-6593938b3238","html_url":"https://github.com/selfup/lspi","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/selfup%2Flspi","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/selfup%2Flspi/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/selfup%2Flspi/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/selfup%2Flspi/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/selfup","download_url":"https://codeload.github.com/selfup/lspi/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248226379,"owners_count":21068192,"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-13T02:09:19.018Z","updated_at":"2025-04-10T13:43:44.653Z","avatar_url":"https://github.com/selfup.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Local Storage Programming Interface\n\n### Basic ORM for local storage that can save you time!\n\nSuper easy to use!\n\nStore and retrieve valid JSON objects/arrays or simple strings :smile:\n\nMake sure to use polyfills for `Array.from` and `Object.assign` when bundling your application code! :tada:\n\n### Install\n\n`npm install lspi --save`\n\n### Basics\n\n```javascript\nconst lspi = require('lspi');\n\n//= set string -\u003e\nlspi.set('testOne', 'testing');\n// Returns: undefined\n// Stores: \"testing\"\n\n//= get string -\u003e\nlspi.get('testOne');\n// Returns: \"testOne\"\n\n//= set object literal -\u003e\nlspi.set('testOne', {});\n// Returns: undefined\n// Stores: \"{}\"\n\n//= get object literal -\u003e\nlspi.get('testOne');\n// Returns: {}\n\n//= set array -\u003e\nlspi.set('testTwo', []);\n// Returns: undefined\n// Stores: \"[]\"\n\n//= get array -\u003e\nlspi.get('testTwo');\n// Returns: []\n\n//= set array of objects -\u003e\nlspi.set('testOne', [{ name: 'test' }, { name: 'test2' }]);\n// Returns: undefined\n// Stores: \"{\"name\": \"test2\"}\"\n\n//= where query on array of objects -\u003e\nlspi.where('testOne', 'name', 'test2');\n// Returns: [{ name: 'test2' }]\n\n//= update state -\u003e\nlspi.set('test42', { hey: 'hi' });\n\nlspi.update('test42', { ok: 'new stuff' });\n// Returns: undefined\n// Adds ok key and 'new stuff' value to the 'testOne' record\n\nlspi.update('test42', { hey: 'hello' });\n// Returns: undefined\n// Updates hey value to 'hello' instead of 'hi'\n\n//= remove data (singular) -\u003e\nlspi.drop('testOne');\n// Returns: undefined\n// This will delete the 'testOne' record from localStorage\n\n//= remove all data -\u003e\nlspi.dropAll();\n// Returns: undefined\n// Drops ALL localStorage associated to your domain\n\n//= Mutiple set -\u003e\nlspi.sets(['test', { wow: 'wow1' }], ['test2', { wow: 'wow2' }]);\n// Returns: undefined\n// Stores: {wow: 'wow1'} in mthe 'test' key\n// Stores: {wow: 'wow2'} in the 'test2' key\n\nconst testDataOne = lspi.get('test');\nconst testDataTwo = lspi.get('test2');\n\ntestDataOne; // =\u003e {wow: 'wow1'}\ntestDataTwo; // =\u003e {wow: 'wow2'}\n\n//= Multiple get -\u003e\\\nlspi.sets(['test', { wow: 'wow' }], ['test2', { wow: 'wow' }]);\n\nconst testData = lspi.gets('test', 'test2');\n\ntestData; // =\u003e ['test', {wow: 'wow'}], ['test2', {wow: 'wow'}]\n\n//= Multiple drop -\u003e\nlspi.sets(\n  ['test', { wow: 'wow1' }],\n  ['test2', { wow: 'wow2' }],\n  ['test3', { wow: 'wow3' }],\n);\n\nlspi.drops('test', 'test2');\n// Returns: undefined\n// 'test3' -\u003e {wow: 'wow3'} remains\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fselfup%2Flspi","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fselfup%2Flspi","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fselfup%2Flspi/lists"}