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

level-ttl

Package Overview
Dependencies
Maintainers
1
Versions
25
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

level-ttl - npm Package Compare versions

Comparing version 0.6.1 to 1.0.0

399

level-ttl.js

@@ -7,76 +7,101 @@ const after = require('after')

var startTtl = function (db, checkFrequency) {
db._ttl.intervalId = setInterval(function () {
var batch = []
, subBatch = []
, query = {
keyEncoding: 'utf8'
, valueEncoding: 'utf8'
, end: String(Date.now())
}
db._ttl._checkInProgress = true
db._ttl.sub.createReadStream(query)
.on('data', function (data) {
subBatch.push({ type: 'del', key: data.value })
subBatch.push({ type: 'del', key: data.key })
batch.push({ type: 'del', key: data.value })
})
.on('error', db.emit.bind(db, 'error'))
.on('end', function () {
if (batch.length) {
db._ttl.sub.batch(
subBatch
, { keyEncoding: 'utf8' }
, function (err) {
if (err)
db.emit('error', err)
}
)
db._ttl.batch(
batch
, { keyEncoding: 'utf8' }
, function (err) {
if (err)
db.emit('error', err)
}
)
}
})
.on('close', function () {
db._ttl._checkInProgress = false
if (db._ttl._stopAfterCheck) {
stopTtl(db, db._ttl._stopAfterCheck)
db._ttl._stopAfterCheck = null
}
})
}, checkFrequency)
if (db._ttl.intervalId.unref)
db._ttl.intervalId.unref()
}
function startTtl (db, checkFrequency) {
db._ttl.intervalId = setInterval(function () {
var batch = []
, subBatch = []
, query = {
keyEncoding: 'utf8'
, valueEncoding: 'utf8'
, end: String(Date.now())
}
, stopTtl = function (db, callback) {
// can't close a db while an interator is in progress
// so if one is, defer
if (db._ttl._checkInProgress)
return db._ttl._stopAfterCheck = callback
clearInterval(db._ttl.intervalId)
callback && callback()
}
db._ttl._checkInProgress = true
db._ttl.sub.createReadStream(query)
.on('data', function (data) {
subBatch.push({ type: 'del', key: data.value })
subBatch.push({ type: 'del', key: data.key })
batch.push({ type: 'del', key: data.value })
})
.on('error', db.emit.bind(db, 'error'))
.on('end', function () {
if (batch.length) {
db._ttl.sub.batch(
subBatch
, { keyEncoding: 'utf8' }
, function (err) {
if (err)
db.emit('error', err)
}
)
db._ttl.batch(
batch
, { keyEncoding: 'utf8' }
, function (err) {
if (err)
db.emit('error', err)
}
)
}
})
.on('close', function () {
db._ttl._checkInProgress = false
if (db._ttl._stopAfterCheck) {
stopTtl(db, db._ttl._stopAfterCheck)
db._ttl._stopAfterCheck = null
}
})
}, checkFrequency)
if (db._ttl.intervalId.unref)
db._ttl.intervalId.unref()
}
, ttlon = function ttlon (db, keys, ttl, callback) {
var exp = String(Date.now() + ttl)
, batch = []
function stopTtl (db, callback) {
// can't close a db while an interator is in progress
// so if one is, defer
if (db._ttl._checkInProgress)
return db._ttl._stopAfterCheck = callback
clearInterval(db._ttl.intervalId)
callback && callback()
}
if (!Array.isArray(keys))
keys = [ keys ]
function ttlon (db, keys, ttl, callback) {
var exp = String(Date.now() + ttl)
, batch = []
ttloff(db, keys, function () {
keys.forEach(function (key) {
if (typeof key != 'string')
key = key.toString()
batch.push({ type: 'put', key: key , value: exp })
batch.push({ type: 'put', key: exp + '\xff' + key, value: key })
})
if (!Array.isArray(keys))
keys = [ keys ]
ttloff(db, keys, function () {
keys.forEach(function (key) {
if (typeof key != 'string')
key = key.toString()
batch.push({ type: 'put', key: key , value: exp })
batch.push({ type: 'put', key: exp + '!' + key, value: key })
})
if (!batch.length)
return callback && callback()
db._ttl.sub.batch(
batch
, { keyEncoding: 'utf8', valueEncoding: 'utf8' }
, function (err) {
if (err)
db.emit('error', err)
callback && callback()
}
)
})
}
function ttloff (db, keys, callback) {
if (!Array.isArray(keys))
keys = [ keys ]
var batch = []
, done = after(keys.length, function (err) {
if (err)
db.emit('error', err)
if (!batch.length)

@@ -95,156 +120,132 @@ return callback && callback()

})
}
, ttloff = function ttloff (db, keys, callback) {
if (!Array.isArray(keys))
keys = [ keys ]
keys.forEach(function (key) {
if (typeof key != 'string')
key = key.toString()
var batch = []
, done = after(keys.length, function (err) {
if (err)
db.emit('error', err)
db._ttl.sub.get(
key
, { keyEncoding: 'utf8', valueEncoding: 'utf8' }
, function (err, exp) {
if (!err && exp > 0) {
batch.push({ type: 'del', key: key })
batch.push({ type: 'del', key: exp + '!' + key })
}
done(err && err.name != 'NotFoundError' && err)
}
)
})
}
if (!batch.length)
return callback && callback()
function put (db, key, value, options, callback) {
var ttl
, done
, _callback = callback
db._ttl.sub.batch(
batch
, { keyEncoding: 'utf8', valueEncoding: 'utf8' }
, function (err) {
if (err)
db.emit('error', err)
callback && callback()
}
)
})
if (typeof options == 'object' && (ttl = options.ttl) > 0
&& key !== null && key !== undefined
&& value !== null && value !== undefined) {
keys.forEach(function (key) {
if (typeof key != 'string')
key = key.toString()
done = after(2, _callback || function () {})
callback = done
ttlon(db, key, options.ttl, done)
}
db._ttl.sub.get(
key
, { keyEncoding: 'utf8', valueEncoding: 'utf8' }
, function (err, exp) {
if (!err && exp > 0) {
batch.push({ type: 'del', key: key })
batch.push({ type: 'del', key: exp + '\xff' + key })
}
done(err && err.name != 'NotFoundError' && err)
}
)
})
}
db._ttl.put.call(db, key, value, options, callback)
}
, put = function (db, key, value, options, callback) {
var ttl
, done
, _callback = callback
function ttl (db, key, _ttl, callback) {
if (_ttl > 0 && key !== null && key !== undefined)
ttlon(db, key, _ttl, callback)
}
if (typeof options == 'object' && (ttl = options.ttl) > 0
&& key !== null && key !== undefined
&& value !== null && value !== undefined) {
function del (db, key, options, callback) {
var done
, _callback = callback
if (key !== null && key !== undefined) {
done = after(2, _callback || function () {})
callback = done
ttloff(db, key, done)
}
done = after(2, _callback || function () {})
callback = done
ttlon(db, key, options.ttl, done)
}
db._ttl.del.call(db, key, options, callback)
}
db._ttl.put.call(db, key, value, options, callback)
}
function batch (db, arr, options, callback) {
var ttl
, done
, on
, off
, _callback = callback
, ttl = function (db, key, ttl, callback) {
if (ttl > 0 && key !== null && key !== undefined)
ttlon(db, key, ttl, callback)
}
if (typeof options == 'object' && (ttl = options.ttl) > 0 && Array.isArray(arr)) {
done = after(3, _callback || function () {})
callback = done
, del = function (db, key, options, callback) {
var done
, _callback = callback
if (key !== null && key !== undefined) {
done = after(2, _callback || function () {})
callback = done
ttloff(db, key, done)
}
on = []
off = []
arr.forEach(function (entry) {
if (!entry || entry.key === null || entry.key === undefined)
return
db._ttl.del.call(db, key, options, callback)
}
if (entry.type == 'put' && entry.value !== null && entry.value !== undefined)
on.push(entry.key)
if (entry.type == 'del')
off.push(entry.key)
})
, batch = function (db, arr, options, callback) {
var ttl
, done
, on
, off
, _callback = callback
if (on.length)
ttlon(db, on, options.ttl, done)
else
done()
if (off.length)
ttloff(db, off, done)
else
done()
}
if (typeof options == 'object' && (ttl = options.ttl) > 0 && Array.isArray(arr)) {
done = after(3, _callback || function () {})
callback = done
db._ttl.batch.call(db, arr, options, callback)
}
on = []
off = []
arr.forEach(function (entry) {
if (!entry || entry.key === null || entry.key === undefined)
return
function close (db, callback) {
stopTtl(db, function () {
if (db._ttl && typeof db._ttl.close == 'function')
return db._ttl.close.call(db, callback)
callback && callback()
})
}
if (entry.type == 'put' && entry.value !== null && entry.value !== undefined)
on.push(entry.key)
if (entry.type == 'del')
off.push(entry.key)
})
function setup (db, options) {
if (db._ttl)
return
if (on.length)
ttlon(db, on, options.ttl, done)
else
done()
if (off.length)
ttloff(db, off, done)
else
done()
}
options = xtend({
methodPrefix : ''
, sublevel : 'ttl'
, checkFrequency : DEFAULT_FREQUENCY
}, options)
db._ttl.batch.call(db, arr, options, callback)
}
var sdb = typeof db.sublevels == 'object' ? db : sublevel(db)
, close = function (db, callback) {
stopTtl(db, function () {
if (db._ttl && typeof db._ttl.close == 'function')
return db._ttl.close.call(db, callback)
callback && callback()
})
}
db._ttl = {
put : db.put.bind(db)
, del : db.del.bind(db)
, batch : db.batch.bind(db)
, close : db.close.bind(db)
, sub : sdb.sublevel(options.sublevel)
}
, setup = function (db, options) {
if (db._ttl)
return
db[options.methodPrefix + 'put'] = put.bind(null, db)
db[options.methodPrefix + 'del'] = del.bind(null, db)
db[options.methodPrefix + 'batch'] = batch.bind(null, db)
db[options.methodPrefix + 'ttl'] = ttl.bind(null, db)
db[options.methodPrefix + 'stop'] = stopTtl.bind(null, db)
// we must intercept close()
db.close = close.bind(null, db)
options = xtend({
methodPrefix : ''
, sublevel : 'ttl'
, checkFrequency : DEFAULT_FREQUENCY
}, options)
startTtl(db, options.checkFrequency)
db = sublevel(db)
return db
}
db._ttl = {
put : db.put
, del : db.del
, batch : db.batch
, close : db.close
, sub : db.sublevel(options.sublevel)
}
db[options.methodPrefix + 'put'] = put.bind(null, db)
db[options.methodPrefix + 'del'] = del.bind(null, db)
db[options.methodPrefix + 'batch'] = batch.bind(null, db)
db[options.methodPrefix + 'ttl'] = ttl.bind(null, db)
db[options.methodPrefix + 'stop'] = stopTtl.bind(null, db)
// we must intercept close()
db.close = close.bind(null, db)
startTtl(db, options.checkFrequency)
return db
}
module.exports = setup
module.exports = setup

@@ -9,3 +9,3 @@ {

],
"version": "0.6.1",
"version": "1.0.0",
"homepage": "https://github.com/rvagg/node-level-ttl",

@@ -27,11 +27,11 @@ "authors": [

"dependencies": {
"after": "~0.8.1",
"xtend": "~2.1.1",
"level-sublevel": "~5.2.0"
"after": ">=0.8.1 <0.9.0-0",
"xtend": ">=2.1.1 <2.2.0-0",
"level-sublevel": ">=5.2.0 <5.3.0-0"
},
"peerDependencies": {},
"devDependencies": {
"tape": "*",
"level": "*",
"rimraf": "*"
"level": ">=0.18.0 <0.19.0-0",
"rimraf": ">=2.2.8 <2.3.0-0",
"tape": ">=2.14.0 <2.15.0-0"
},

@@ -38,0 +38,0 @@ "scripts": {

@@ -13,2 +13,4 @@ # Level TTL [![Build Status](https://secure.travis-ci.org/rvagg/node-level-ttl.png)](http://travis-ci.org/rvagg/node-level-ttl)

***Note: version 1.0.0 data stores are not backward compatible with previous versions. If you have unexpired entries in a data store managed by pre-1.0.0, don't expect them to expire if you upgrade to 1.0.0+.*** *This is due to a level-sublevel change. It is also recommended that you only use level-sublevel 6.0.0+ with level-ttl.*
```js

@@ -18,17 +20,16 @@ var levelup = require('level')

levelup('/tmp/foo.db', function (err, db) {
db = ttl(db)
var db = levelu('/tmp/foo.db')
db = ttl(db)
// --------------------------- put() --------------------------- //
// this entry will only stay in the data store for 1 hour
db.put('foo', 'bar', { ttl: 1000 * 60 * 60 }, function (err) { /* .. */ })
// --------------------------- put() --------------------------- //
// this entry will only stay in the data store for 1 hour
db.put('foo', 'bar', { ttl: 1000 * 60 * 60 }, function (err) { /* .. */ })
// -------------------------- batch() -------------------------- //
// the two 'put' entries will only stay in the data store for 1 hour
db.batch([
{ type: 'put', key: 'foo', value: 'bar' }
, { type: 'put', key: 'bam', value: 'boom' }
, { type: 'del', key: 'w00t' }
], { ttl: 1000 * 60 * 60 }, function (err) { /* .. */ })
})
// -------------------------- batch() -------------------------- //
// the two 'put' entries will only stay in the data store for 1 hour
db.batch([
{ type: 'put', key: 'foo', value: 'bar' }
, { type: 'put', key: 'bam', value: 'boom' }
, { type: 'del', key: 'w00t' }
], { ttl: 1000 * 60 * 60 }, function (err) { /* .. */ })
```

@@ -48,8 +49,7 @@

```js
levelup('/tmp/foo.db', function (err, db) {
// scan for deletables every second
db = ttl(db, { checkFrequency: 1000 })
var db = level('/tmp/foo.db')
// scan for deletables every second
db = ttl(db, { checkFrequency: 1000 })
/* .. */
})
/* .. */
```

@@ -56,0 +56,0 @@

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

const test = require('tape')
, rimraf = require('rimraf')
, levelup = require('level')
, sublevel = require('level-sublevel')
, ttl = require('./')
const test = require('tape')
, rimraf = require('rimraf')
, levelup = require('level')
, sublevel = require('level-sublevel')
, listStream = require('list-stream')
, ttl = require('./')
function fixtape (t) {

@@ -13,2 +15,3 @@ t.like = function (str, reg, msg) {

function ltest (name, fn, opts) {

@@ -39,27 +42,32 @@ test(name, function (t) {

function db2arr (createReadStream, t, callback, opts) {
var arr = []
createReadStream(opts)
.on('data', arr.push.bind(arr))
.on('error', function (err) {
t.fail(err)
})
.on('close', callback.bind(null, null, arr))
.pipe(listStream.obj (function (err, arr) {
if (err)
return t.fail(err)
callback(null, arr)
}))
}
/*
function printdb (createReadStream, callback) {
console.log('================================================')
createReadStream()
.on('data', console.log)
.on('end', function () {
console.log('================================================')
})
.on('close', callback)
function contains (t, arr, key, value) {
for (var i = 0; i < arr.length; i++) {
if (typeof key == 'string' && arr[i].key != key)
continue
if (typeof value == 'string' && arr[i].value != value)
continue
if (key instanceof RegExp && !key.test(arr[i].key))
continue
if (value instanceof RegExp && !value.test(arr[i].value))
continue
return t.pass('contains {' + (key.source || key) + ', ' + (value.source || value) + '}')
}
return t.fail('does not contain {' + (key.source || key) + ', ' + (value.source || value) + '}')
}
*/
// test that the standard API is working as it should
// kind of a lame test but we know they should throw
ltest('test single ttl entry', function (db, t) {
false && ltest('test single ttl entry', function (db, t) {
t.throws(db.put.bind(db), { name: 'WriteError', message: 'put() requires key and value arguments' })

@@ -82,8 +90,6 @@ t.throws(db.del.bind(db), { name: 'WriteError', message: 'del() requires a key argument' })

ts++
t.deepEqual(arr, [
{ key: 'bar', value: 'barvalue' }
, { key: 'foo', value: 'foovalue' }
, { key: 'ÿttlÿ' + ts + 'ÿbar', value: 'bar' }
, { key: 'ÿttlÿbar', value: String(ts) }
])
contains(t, arr, /!ttl!\d{13}!bar/, 'bar')
contains(t, arr, '!ttl!bar', /\d{13}/)
contains(t, arr, 'bar', 'barvalue')
contains(t, arr, 'foo', 'foovalue')
setTimeout(function () {

@@ -104,2 +110,3 @@ db2arr(createReadStream, t, function (err, arr) {

ltest('test multiple ttl entries with put', function (db, t, createReadStream) {

@@ -109,26 +116,19 @@ var expect = function (delay, keys) {

db2arr(createReadStream, t, function (err, arr) {
var _kl = Math.floor((arr.length - 1) / 3)
t.notOk(err, 'no error')
t.equal(arr.length, 1 + keys * 3, 'correct number of entries in db')
t.deepEqual(arr[0], { key: 'afoo', value: 'foovalue' })
contains(t, arr, 'afoo', 'foovalue')
if (keys >= 1) {
t.deepEqual(arr[1], { key: 'bar1', value: 'barvalue1' })
t.equal(arr[1 + _kl * 2 - 1].value, 'bar1')
t.like(arr[1 + _kl * 2 - 1].key, /^ÿttlÿ\d{13}ÿbar1$/)
t.equal(arr[1 + _kl * 2].key, 'ÿttlÿbar1')
t.like(arr[1 + _kl * 2].value, /^\d{13}$/)
contains(t, arr, 'bar1', 'barvalue1')
contains(t, arr, /^!ttl!\d{13}!bar1$/, 'bar1')
contains(t, arr, '!ttl!bar1', /^\d{13}$/)
}
if (keys >= 2) {
t.deepEqual(arr[2], { key: 'bar2', value: 'barvalue2' })
t.equal(arr[1 + _kl * 2 - 2].value, 'bar2')
t.like(arr[1 + _kl * 2 - 2].key, /^ÿttlÿ\d{13}ÿbar2$/)
t.equal(arr[1 + _kl * 2 + 1].key, 'ÿttlÿbar2')
t.like(arr[1 + _kl * 2 + 1].value, /^\d{13}$/)
contains(t, arr, 'bar2', 'barvalue2')
contains(t, arr, /^!ttl!\d{13}!bar2$/, 'bar2')
contains(t, arr, '!ttl!bar2', /^\d{13}$/)
}
if (keys >= 3) {
t.deepEqual(arr[3], { key: 'bar3', value: 'barvalue3' })
t.equal(arr[1 + _kl * 2 - 3].value, 'bar3')
t.like(arr[1 + _kl * 2 - 3].key, /^ÿttlÿ\d{13}ÿbar3$/)
t.equal(arr[1 + _kl * 2 + 2].key, 'ÿttlÿbar3')
t.like(arr[1 + _kl * 2 + 2].value, /^\d{13}$/)
contains(t, arr, 'bar3', 'barvalue3')
contains(t, arr, /^!ttl!\d{13}!bar3$/, 'bar3')
contains(t, arr, '!ttl!bar3', /^\d{13}$/)
}

@@ -152,2 +152,3 @@ })

ltest('test multiple ttl entries with batch-put', function (db, t, createReadStream) {

@@ -157,33 +158,24 @@ var expect = function (delay, keys) {

db2arr(createReadStream, t, function (err, arr) {
var _kl = Math.floor((arr.length - 1) / 3)
t.notOk(err, 'no error')
t.equal(arr.length, 1 + keys * 3, 'correct number of entries in db')
t.deepEqual(arr[0], { key: 'afoo', value: 'foovalue' })
contains(t, arr, 'afoo', 'foovalue')
if (keys >= 1) {
t.deepEqual(arr[1], { key: 'bar1', value: 'barvalue1' })
t.equal(arr[1 + _kl * 1].value, 'bar1')
t.like(arr[1 + _kl * 1].key, /^ÿttlÿ\d{13}ÿbar1$/)
t.equal(arr[1 + _kl * 2].key, 'ÿttlÿbar1')
t.like(arr[1 + _kl * 2].value, /^\d{13}$/)
contains(t, arr, 'bar1', 'barvalue1')
contains(t, arr, /^!ttl!\d{13}!bar1$/, 'bar1')
contains(t, arr, '!ttl!bar1', /^\d{13}$/)
}
if (keys >= 2) {
t.deepEqual(arr[2], { key: 'bar2', value: 'barvalue2' })
t.equal(arr[1 + _kl * 1 + 1].value, 'bar2')
t.like(arr[1 + _kl * 1 + 1].key, /^ÿttlÿ\d{13}ÿbar2$/)
t.equal(arr[1 + _kl * 2 + 1].key, 'ÿttlÿbar2')
t.like(arr[1 + _kl * 2 + 1].value, /^\d{13}$/)
contains(t, arr, 'bar2', 'barvalue2')
contains(t, arr, /^!ttl!\d{13}!bar2$/, 'bar2')
contains(t, arr, '!ttl!bar2', /^\d{13}$/)
}
if (keys >= 3) {
t.deepEqual(arr[3], { key: 'bar3', value: 'barvalue3' })
t.equal(arr[1 + _kl * 1 + 2].value, 'bar3')
t.like(arr[1 + _kl * 1 + 2].key, /^ÿttlÿ\d{13}ÿbar3$/)
t.equal(arr[1 + _kl * 2 + 2].key, 'ÿttlÿbar3')
t.like(arr[1 + _kl * 2 + 2].value, /^\d{13}$/)
contains(t, arr, 'bar3', 'barvalue3')
contains(t, arr, /^!ttl!\d{13}!bar3$/, 'bar3')
contains(t, arr, '!ttl!bar3', /^\d{13}$/)
}
if (keys >= 4) {
t.deepEqual(arr[4], { key: 'bar4', value: 'barvalue4' })
t.equal(arr[1 + _kl * 1 + 3].value, 'bar4')
t.like(arr[1 + _kl * 1 + 3].key, /^ÿttlÿ\d{13}ÿbar4$/)
t.equal(arr[1 + _kl * 2 + 3].key, 'ÿttlÿbar4')
t.like(arr[1 + _kl * 2 + 3].value, /^\d{13}$/)
if (keys >= 3) {
contains(t, arr, 'bar4', 'barvalue4')
contains(t, arr, /^!ttl!\d{13}!bar4$/, 'bar4')
contains(t, arr, '!ttl!bar4', /^\d{13}$/)
}

@@ -209,2 +201,3 @@ })

ltest('test prolong entry life with additional put', function (db, t, createReadStream) {

@@ -227,8 +220,6 @@ var putBar = function () {

}
t.deepEqual(arr, [
{ key: 'bar', value: 'barvalue' }
, { key: 'foo', value: 'foovalue' }
, { key: 'ÿttlÿ' + ts + 'ÿbar', value: 'bar' }
, { key: 'ÿttlÿbar', value: String(ts) }
])
contains(t, arr, 'bar', 'barvalue')
contains(t, arr, 'foo', 'foovalue')
contains(t, arr, /!ttl!\d{13}!bar/, 'bar')
contains(t, arr, '!ttl!bar', /\d{13}/)
})

@@ -251,2 +242,3 @@ }, delay)

ltest('test prolong entry life with ttl(key, ttl)', function (db, t, createReadStream) {

@@ -269,8 +261,6 @@ var ttlBar = function () {

}
t.deepEqual(arr, [
{ key: 'bar', value: 'barvalue' }
, { key: 'foo', value: 'foovalue' }
, { key: 'ÿttlÿ' + ts + 'ÿbar', value: 'bar' }
, { key: 'ÿttlÿbar', value: String(ts) }
])
contains(t, arr, 'bar', 'barvalue')
contains(t, arr, 'foo', 'foovalue')
contains(t, arr, /!ttl!\d{13}!bar/, 'bar')
contains(t, arr, '!ttl!bar', /\d{13}/)
})

@@ -313,8 +303,6 @@ }, delay)

}
t.deepEqual(arr, [
{ key: 'bar', value: 'barvalue' }
, { key: 'foo', value: 'foovalue' }
, { key: 'ÿttlÿ' + ts + 'ÿbar', value: 'bar' }
, { key: 'ÿttlÿbar', value: String(ts) }
])
contains(t, arr, 'bar', 'barvalue')
contains(t, arr, 'foo', 'foovalue')
contains(t, arr, /!ttl!\d{13}!bar/, 'bar')
contains(t, arr, '!ttl!bar', /\d{13}/)
}

@@ -357,8 +345,6 @@ })

}
t.deepEqual(arr, [
{ key: 'bar', value: '{"v":"barvalue"}' }
, { key: 'foo', value: '{"v":"foovalue"}' }
, { key: 'ÿttlÿ' + ts + 'ÿbar', value: 'bar' }
, { key: 'ÿttlÿbar', value: String(ts) }
])
contains(t, arr, 'bar', '{"v":"barvalue"}')
contains(t, arr, 'foo', '{"v":"foovalue"}')
contains(t, arr, /!ttl!\d{13}!bar/, 'bar')
contains(t, arr, '!ttl!bar', /\d{13}/)
}

@@ -437,3 +423,4 @@ }, { valueEncoding: 'utf8' })

test("Stopping a ttl-db based on a sublevel-db", function (t) {
test('Stopping a ttl-db based on a sublevel-db', function (t) {
var location = '__ttl-' + Math.random()

@@ -440,0 +427,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