Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

flexible-storage

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

flexible-storage - npm Package Compare versions

Comparing version 1.1.0 to 1.1.1

.nyc_output/21ba82109b4a0f8568ff6cedc4f40912.json

4

build/index.js

@@ -95,5 +95,7 @@ (function webpackUniversalModuleDefinition(root, factory) {

var FlexibleStorage = exports.FlexibleStorage = function () {
function FlexibleStorage(storage, keyPrefix) {
function FlexibleStorage(storage) {
var _this = this;
var keyPrefix = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "";
_classCallCheck(this, FlexibleStorage);

@@ -100,0 +102,0 @@

@@ -6,3 +6,3 @@ /// <reference types="moment" />

protected storage: Storage;
constructor(storage: Storage, keyPrefix: string | ((key: string) => string));
constructor(storage: Storage, keyPrefix?: string | ((key: string) => string));
exists(key: string): boolean;

@@ -9,0 +9,0 @@ pull: <T = any>(key: string, validator?: (value?: T) => void | T) => T;

{
"name": "flexible-storage",
"version": "1.1.0",
"version": "1.1.1",
"description": "Cache on frontend using LocalStorage",

@@ -5,0 +5,0 @@ "main": "src/index.ts",

@@ -1,2 +0,2 @@

import { Moment } from "moment";
import {Moment} from "moment";

@@ -7,3 +7,3 @@ export class FlexibleStorage {

constructor(storage: Storage, keyPrefix: string | ((key: string) => string)) {
constructor(storage: Storage, keyPrefix: string | ((key: string) => string) = "") {
this.storage = storage;

@@ -42,3 +42,3 @@ this.buildKey = "function" === typeof keyPrefix

const { value } = JSON.parse(this.storage.getItem(this.buildKey(key)));
const {value} = JSON.parse(this.storage.getItem(this.buildKey(key)));

@@ -45,0 +45,0 @@ return validator(value) as T;

@@ -22,2 +22,5 @@ import { expect } from "chai";

expect(cacheWithDefaultBuildKey.buildKey("key")).to.be.equal("prefix_key");
const cacheWithNoKeyPrefix = new FlexibleStorage(storage);
expect(cacheWithNoKeyPrefix.buildKey("key")).to.equal("key");
});

@@ -24,0 +27,0 @@

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc