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

keyv

Package Overview
Dependencies
Maintainers
2
Versions
63
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

keyv - npm Package Compare versions

Comparing version 4.2.0 to 4.2.1

7

package.json
{
"name": "keyv",
"version": "4.2.0",
"version": "4.2.1",
"description": "Simple key-value storage with support for multiple backends",

@@ -12,5 +12,5 @@ "main": "src/index.js",

"xo": {
"extends": "xo-lukechilds",
"rules": {
"unicorn/prefer-module": 0
"unicorn/prefer-module": 0,
"unicorn/prefer-node-protocol": 0
}

@@ -42,3 +42,2 @@ },

"ava": "^4.1.0",
"eslint-config-xo-lukechilds": "^1.0.1",
"eslint-plugin-promise": "^6.0.0",

@@ -45,0 +44,0 @@ "nyc": "^15.1.0",

@@ -1,7 +0,7 @@

import EventEmitter from 'node:events';
import {EventEmitter} from 'events';
declare class Keyv extends EventEmitter {
declare class Keyv<T = any> extends EventEmitter {
constructor(uri: string, options: Keyv.Options);
get(key: string, options: any): Promise<any>;
set(key: string, value: any, ttl: number): Promise<boolean>;
get(key: string, options?: any): Promise<T>;
set(key: string, value: T, ttl?: number): Promise<boolean>;
delete(key: string): Promise<boolean>;

@@ -19,4 +19,6 @@ clear(): Promise<void>;

}
type Store<T> = Keyv<T>;
}
export = Keyv;

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

deserialize: JSONB.parse,
...((typeof uri === 'string') ? { uri } : uri),
...((typeof uri === 'string') ? {uri} : uri),
...options,

@@ -47,3 +47,3 @@ };

if (!this.opts.store) {
const adapterOptions = { ...this.opts };
const adapterOptions = {...this.opts};
this.opts.store = loadStore(adapterOptions);

@@ -54,6 +54,6 @@ }

const brotli = compressBrotli(this.opts.compress.opts);
this.opts.serialize = async ({ value, expires }) => brotli.serialize({ value: await brotli.compress(value), expires });
this.opts.serialize = async ({value, expires}) => brotli.serialize({value: await brotli.compress(value), expires});
this.opts.deserialize = async data => {
const { value, expires } = brotli.deserialize(data);
return { value: await brotli.decompress(value), expires };
const {value, expires} = brotli.deserialize(data);
return {value: await brotli.decompress(value), expires};
};

@@ -119,3 +119,3 @@ }

get(key, options) {
const { store } = this.opts;
const {store} = this.opts;
const isArray = Array.isArray(key);

@@ -208,3 +208,3 @@ const keyPrefixed = isArray ? this._getKeyPrefixArray(key) : this._getKeyPrefix(key);

const { store } = this.opts;
const {store} = this.opts;

@@ -218,3 +218,3 @@ return Promise.resolve()

value = { value, expires };
value = {value, expires};
return this.opts.serialize(value);

@@ -227,3 +227,3 @@ })

delete(key) {
const { store } = this.opts;
const {store} = this.opts;
if (Array.isArray(key)) {

@@ -251,3 +251,3 @@ const keyPrefixed = this._getKeyPrefixArray(key);

clear() {
const { store } = this.opts;
const {store} = this.opts;
return Promise.resolve()

@@ -259,3 +259,3 @@ .then(() => store.clear());

const keyPrefixed = this._getKeyPrefix(key);
const { store } = this.opts;
const {store} = this.opts;
return Promise.resolve()

@@ -262,0 +262,0 @@ .then(async () => {

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