Socket
Socket
Sign inDemoInstall

simple-storage

Package Overview
Dependencies
0
Maintainers
1
Versions
19
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 3.2.0 to 4.0.0

6

dist/storage.d.ts
export declare type SimpleStorageType = "session" | "local";
export interface SimpleStorageItem {
key: string;
value: any;
}
export interface StringDictionary {

@@ -14,3 +18,3 @@ [key: string]: string;

readonly length: number;
getAllItems(): any[];
getAllItems(): SimpleStorageItem[];
getAllItemsAsync(): Promise<any[]>;

@@ -17,0 +21,0 @@ }

5

dist/storage.js
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
;
;
/** Fallback storage provider for environments where the Storage API isn't available */

@@ -88,4 +89,4 @@ var AltStorage = /** @class */ (function () {

if (key !== null) {
item[key] = this.getItem(key);
items.push(item);
var value = this.getItem(key);
items.push({ key: key, value: value });
}

@@ -92,0 +93,0 @@ }

{
"name": "simple-storage",
"version": "3.2.0",
"version": "4.0.0",
"description": "Simple localStorage / sessionStorage supporting objects and arrays",

@@ -5,0 +5,0 @@ "homepage": "https://github.com/tuxracer/simple-storage",

@@ -23,7 +23,7 @@ # simple-storage

const items = simpleSessionStorage.getAllItems();
console.log(items); // [{ pets: {dogs: 3, cats: 1} }]
console.log(items); // [{ key: "pets", value: {dogs: 3, cats: 1} }]
// get all items async
const i = await simpleSessionStorage.getAllItemsAsync();
console.log(i); // [{ pets: {dogs: 3, cats: 1} }]
console.log(i); // [{ key: "pets", value: {dogs: 3, cats: 1} }]

@@ -55,7 +55,7 @@ // remove item

const items = simpleLocalStorage.getAllItems();
console.log(items); // [{ pets: {dogs: 3, cats: 1} }]
console.log(items); // [{ key: "pets", value: {dogs: 3, cats: 1} }]
// get all items async
const i = await simpleLocalStorage.getAllItemsAsync();
console.log(i); // [{ pets: {dogs: 3, cats: 1} }]
console.log(i); // [{ key: "pets", value: {dogs: 3, cats: 1} }]

@@ -62,0 +62,0 @@ // remove item

export type SimpleStorageType = "session" | "local";
export interface SimpleStorageItem {
key: string;
value: any;
};
export interface StringDictionary {

@@ -95,3 +100,3 @@ [key: string]: string;

getAllItems() {
const items: any[] = [];
const items: SimpleStorageItem[] = [];

@@ -103,4 +108,4 @@ for(let i = this.length - 1; i >= 0; i--) {

if (key !== null) {
item[key] = this.getItem(key);
items.push(item);
const value = this.getItem(key);
items.push({ key, value });
}

@@ -107,0 +112,0 @@ }

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc