Socket
Socket
Sign inDemoInstall

@algolia/cache-in-memory

Package Overview
Dependencies
Maintainers
59
Versions
75
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@algolia/cache-in-memory - npm Package Compare versions

Comparing version 4.0.0-beta.8 to 4.0.0-beta.9

6

dist/cache-in-memory.cjs.js

@@ -5,3 +5,3 @@ 'use strict';

function createInMemoryCache() {
function createInMemoryCache(options = { serializable: true }) {
/* eslint-disable functional/immutable-data, functional/no-let, functional/prefer-readonly-type */

@@ -15,3 +15,3 @@ let cache = {};

if (keyAsString in cache) {
return Promise.resolve(Object.assign({}, cache[keyAsString]));
return Promise.resolve(options.serializable ? JSON.parse(cache[keyAsString]) : cache[keyAsString]);
}

@@ -23,3 +23,3 @@ const promise = defaultValue();

set(key, value) {
cache[JSON.stringify(key)] = value;
cache[JSON.stringify(key)] = options.serializable ? JSON.stringify(value) : value;
return Promise.resolve(value);

@@ -26,0 +26,0 @@ },

import { Cache } from '@algolia/cache-common';
export declare function createInMemoryCache(): Cache;
export declare function createInMemoryCache(options?: InMemoryCacheOptions): Cache;
export declare type InMemoryCacheOptions = {
readonly serializable?: boolean;
};
export { }

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

function createInMemoryCache() {
function createInMemoryCache(options = { serializable: true }) {
/* eslint-disable functional/immutable-data, functional/no-let, functional/prefer-readonly-type */

@@ -10,3 +10,3 @@ let cache = {};

if (keyAsString in cache) {
return Promise.resolve(Object.assign({}, cache[keyAsString]));
return Promise.resolve(options.serializable ? JSON.parse(cache[keyAsString]) : cache[keyAsString]);
}

@@ -18,3 +18,3 @@ const promise = defaultValue();

set(key, value) {
cache[JSON.stringify(key)] = value;
cache[JSON.stringify(key)] = options.serializable ? JSON.stringify(value) : value;
return Promise.resolve(value);

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

{
"name": "@algolia/cache-in-memory",
"version": "4.0.0-beta.8",
"version": "4.0.0-beta.9",
"private": false,

@@ -16,4 +16,4 @@ "description": "Promise-based cache library using memory.",

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