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

@algolia/cache-browser-local-storage

Package Overview
Dependencies
Maintainers
61
Versions
75
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@algolia/cache-browser-local-storage - npm Package Compare versions

Comparing version 4.0.0-beta.11 to 4.0.0-beta.12

4

dist/cache-browser-local-storage.cjs.js

@@ -6,6 +6,4 @@ 'use strict';

function createBrowserLocalStorageCache(options) {
/* eslint-disable functional/immutable-data */
const storage = options.localStorage || window.localStorage;
const namespaceKey = `algoliasearch-client-js-${options.key}`;
// eslint-disable-next-line functional/prefer-readonly-type
const getNamespace = () => {

@@ -32,2 +30,3 @@ return JSON.parse(storage.getItem(namespaceKey) || '{}');

const namespace = getNamespace();
// eslint-disable-next-line functional/immutable-data
namespace[JSON.stringify(key)] = value;

@@ -41,2 +40,3 @@ storage.setItem(namespaceKey, JSON.stringify(namespace));

const namespace = getNamespace();
// eslint-disable-next-line functional/immutable-data
delete namespace[JSON.stringify(key)];

@@ -43,0 +43,0 @@ storage.setItem(namespaceKey, JSON.stringify(namespace));

import { Cache } from '@algolia/cache-common';
export declare type BrowserLocalStorageOptions = {
/**
* The cache key.
*/
readonly key: string;
/**
* The native local storage implementation.
*/
readonly localStorage?: Storage;
readonly fallback?: Cache;
};

@@ -8,0 +13,0 @@

function createBrowserLocalStorageCache(options) {
/* eslint-disable functional/immutable-data */
const storage = options.localStorage || window.localStorage;
const namespaceKey = `algoliasearch-client-js-${options.key}`;
// eslint-disable-next-line functional/prefer-readonly-type
const getNamespace = () => {

@@ -27,2 +25,3 @@ return JSON.parse(storage.getItem(namespaceKey) || '{}');

const namespace = getNamespace();
// eslint-disable-next-line functional/immutable-data
namespace[JSON.stringify(key)] = value;

@@ -36,2 +35,3 @@ storage.setItem(namespaceKey, JSON.stringify(namespace));

const namespace = getNamespace();
// eslint-disable-next-line functional/immutable-data
delete namespace[JSON.stringify(key)];

@@ -38,0 +38,0 @@ storage.setItem(namespaceKey, JSON.stringify(namespace));

{
"name": "@algolia/cache-browser-local-storage",
"version": "4.0.0-beta.11",
"version": "4.0.0-beta.12",
"private": false,

@@ -16,4 +16,4 @@ "description": "Promise-based cache library for browser using local storage.",

"dependencies": {
"@algolia/cache-common": "4.0.0-beta.11"
"@algolia/cache-common": "4.0.0-beta.12"
}
}
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