UNPKG

jsi-just-save-it

Version:

JSI[just,save,it] the most SUPER SUPREME storage wrapper

47 lines 3.73 kB
{ "name": "jsi-just-save-it", "version": "1.1.0", "description": "JSI[just,save,it] the most SUPER SUPREME storage wrapper", "author": { "name": "Realfakenerd", "url": "https://github.com/realfakenerd" }, "repository": { "type": "git", "url": "https://github.com/realfakenerd/jsi" }, "homepage": "https://github.com/realfakenerd/jsi#readme", "bugs": { "url": "https://github.com/realfakenerd/jsi/issues" }, "main": "jsi-dev.cjs", "module": "jsi-dev.mjs", "unpkg": "dist/jsi.min.js", "jsdelivr": "dist/jsi.min.js", "devDependencies": { "rollup": "^2.64.0", "rollup-plugin-terser": "^7.0.2" }, "type": "module", "license": "MIT", "engines": { "node": ">=16.5.0" }, "keywords": [ "storage", "localstorage", "local-storage", "memorystroage", "sessionstorage", "session-storage", "memory-stroage", "vue-plugin", "watch", "es6-modules" ], "private": false, "scripts": { "build": "rollup -c rollup.config.js" }, "readme": "# JSI[just,save,it] (͠≖ ͜ʖ͠≖)👌\r\n\r\n## The most SUPER SUPREME of all Storage wrappers\r\n\r\n<p align=\"center\">\r\n <a href=\"https://github.com/realfakenerd/jsi\" alt=\"LINK GitHub package.json version (subfolder of monorepo)\"> <img alt=\"GitHub package.json version (subfolder of monorepo)\" src=\"https://img.shields.io/github/package-json/v/realfakenerd/jsi?color=lightblue&style=flat-square\"> </a>\r\n <a href=\"https://github.com/realfakenerd/jsi\" alt=\"LINK GitHub package.json version (subfolder of monorepo)\"><img alt=\"GitHub code size in bytes\" src=\"https://img.shields.io/github/languages/code-size/realfakenerd/jsi?color=blue&style=flat-square\">\r\n </a>\r\n \r\n</p>\r\n\r\nIt's small, easy and agnostic, runs on every framework or with vanilla Js, it automatically stringify **data** and if the data it's already a string, it doesn't stringify, just save the data as it is. JSI also have type anotations to help with intellisense and a mini tutorial on the lib.\r\n\r\nTODOS:\r\n\r\n- make it selects between local and session storage\r\n- make better and smarter 'ifs' and/or 'switches\r\n- make the logo\r\n- make an Doc page an site\r\n- host it on most CDNs\r\n- make callbacks to give you awesome dev granular control over the localStorage\r\n- make more todos and finalizes these Promises() above :)\r\n\r\n## Instalation:\r\n\r\n```js\r\n\r\nnpm i jsi-just-save-it // with npm\r\n\r\nyarn add jsi-just-save-it // better on yarn\r\n\r\npnpm add jsi-just-save-it // even better on pnpm\r\n\r\n<script src=\"https://cdn.jsdelivr.net/npm/jsi-just-save-it\">\r\n/** use it as an iife from jsdelivr */\r\n</script>\r\n<script src=\"https://unpkg.com/jsi-just-save-it@1.0.0/dist/jsi.min.js\">\r\n/** or from unpkg */\r\n</script>\r\n\r\n```\r\n\r\n## Usage:\r\n\r\n```js\r\nimport { useJSIStorage } from \"jsi-just-save-it\";\r\n\r\nconst data = {\r\n films: [\"Rogue One\", \"Skywalker Saga\", \"Solo\"],\r\n series: [\"Bad Batch\", \"Mandalorian\", \"Rebels\"],\r\n games: [\"Knights of the old republic\", \"Fallen Order\", \"Old Republic\"],\r\n};\r\n\r\nconst jsi = useJSIStorage();\r\n\r\njsi.set(\"sw\", data); // saves it to the localStorage\r\n\r\njsi.set(\"sw - films\"); // throws an error, so be sure to put some data\r\n\r\njsi.set(data); // also throws an error, the name needs to be a string type\r\n\r\nconst spit = jsi.get(\"sw\"); // gets it from the localStorage and automatically parses it\r\n\r\nconsole.log(spit); // logs out the return of the 'let' above\r\n\r\njsi.remove(\"sw\"); // remove the key, throw an if theres no key with the given name\r\n\r\njsi.clear(); // clear the localStorage\r\n```\r\n" }