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

keyv

Package Overview
Dependencies
Maintainers
1
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 1.0.3 to 1.0.4

3

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

@@ -37,3 +37,2 @@ "main": "src/index.js",

"coveralls": "^2.13.1",
"delay": "^2.0.0",
"eslint-config-xo-lukechilds": "^1.0.0",

@@ -40,0 +39,0 @@ "keyv-mongo": "*",

@@ -66,3 +66,8 @@ 'use strict';

key = this._getKeyPrefix(key);
ttl = ttl || this.opts.ttl;
if (typeof ttl === 'undefined') {
ttl = this.opts.ttl;
}
if (ttl === 0) {
ttl = undefined;
}
const store = this.opts.store;

@@ -69,0 +74,0 @@

@@ -71,3 +71,15 @@ import test from 'ava';

test.serial('.set(key, val, ttl) where ttl is "0" overwrites default tll option and sets key to never expire', async t => {
const startTime = Date.now();
tk.freeze(startTime);
const store = new Map();
const keyv = new Keyv({ store, ttl: 200 });
await keyv.set('foo', 'bar', 0);
t.is(await keyv.get('foo'), 'bar');
tk.freeze(startTime + 250);
t.is(await keyv.get('foo'), 'bar');
tk.reset();
});
const store = () => new Map();
keyvTestSuite(test, Keyv, store);
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