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

bplustree

Package Overview
Dependencies
Maintainers
1
Versions
13
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

bplustree - npm Package Compare versions

Comparing version 1.2.1 to 1.2.2

.jsdoc

18

dist/bplustree.js

@@ -191,2 +191,3 @@ 'use strict';

* In other words:
*
* - if `target` is found before `limit`, it'll stop

@@ -196,2 +197,3 @@ * - if `limit` is reached before `target` was found, it'll stop

* - `keyNotFound` is optional, it lets you decide which key to prefer when the key is not found
*
* @param {Object} options

@@ -202,3 +204,3 @@ * @param {Key} [options.key] - Key at which to start generating.

* @param {string} [options.keyNotFound] - See `notFound` of `BPlusTree.fetch`
* @return {Generator}
* @return {Generator} - e.g. `{ value: { k: 6, v: ['f', 'g'] }, done: false }`
*/

@@ -272,3 +274,3 @@

return _context.abrupt('return', leaf.v[i].slice(0, remainder));
return _context.abrupt('return', { k: leaf.k[i], v: leaf.v[i].slice(0, remainder) });

@@ -281,3 +283,3 @@ case 17:

return _context.abrupt('return', leaf.v[i]);
return _context.abrupt('return', { k: leaf.k[i], v: leaf.v[i] });

@@ -290,7 +292,7 @@ case 19:

return _context.abrupt('return', leaf.v[i]);
return _context.abrupt('return', { k: leaf.k[i], v: leaf.v[i] });
case 21:
_context.next = 23;
return leaf.v[i];
return { k: leaf.k[i], v: leaf.v[i] };

@@ -351,3 +353,3 @@ case 23:

/**
* Check tree's invariants
* Check tree invariants
* @param {Object} options

@@ -421,5 +423,7 @@ * @param {BPTree.tree} [options.root=this.tree] - Tree to check

* Fetch the value(s) stored at `key`.
*
* - `getLeaf` returns the whole leaf
* - `getPath` returns the path from the root to this leaf
* - when defined, `notFound` can be either 'left' or 'right', it controls which key to return when it wasn't found
*
* @param {Key} key

@@ -430,3 +434,3 @@ * @param {Object} options

* @param {boolean} [options.getPath=false] - Return {val: value(s), leaf: leaf, path: pathFromRootToLeaf}
* @param {string} [options.notFound=left|right] - Return what was found left or right from key which doesn't exist
* @param {string} [options.notFound] - either 'left' or 'right' - Return what was found left or right from key which doesn't exist
* @return {Value|Value[]|Leaf|Object|Boolean}

@@ -433,0 +437,0 @@ */

@@ -151,2 +151,3 @@ import 'regenerator-runtime/runtime';

* In other words:
*
* - if `target` is found before `limit`, it'll stop

@@ -156,2 +157,3 @@ * - if `limit` is reached before `target` was found, it'll stop

* - `keyNotFound` is optional, it lets you decide which key to prefer when the key is not found
*
* @param {Object} options

@@ -162,3 +164,3 @@ * @param {Key} [options.key] - Key at which to start generating.

* @param {string} [options.keyNotFound] - See `notFound` of `BPlusTree.fetch`
* @return {Generator}
* @return {Generator} - e.g. `{ value: { k: 6, v: ['f', 'g'] }, done: false }`
*/

@@ -173,2 +175,3 @@ * values({ key, target, limit = Infinity, keyNotFound } = {}) {

leaf = this.fetch(key, { getLeaf: true, notFound: keyNotFound });
if (!leaf) {

@@ -189,12 +192,12 @@ return false;

if (remainder >= 0) {
return leaf.v[i].slice(0, remainder);
return { k: leaf.k[i], v: leaf.v[i].slice(0, remainder) };
}
}
if (target === leaf.v[i][0]) {
return leaf.v[i];
return { k: leaf.k[i], v: leaf.v[i] };
}
if (leaf.n === null && i + 1 === leaf.v.length) {
return leaf.v[i];
return { k: leaf.k[i], v: leaf.v[i] };
}
yield leaf.v[i];
yield { k: leaf.k[i], v: leaf.v[i] };
}

@@ -226,3 +229,3 @@ if (leaf.n !== null) {

/**
* Check tree's invariants
* Check tree invariants
* @param {Object} options

@@ -289,5 +292,7 @@ * @param {BPTree.tree} [options.root=this.tree] - Tree to check

* Fetch the value(s) stored at `key`.
*
* - `getLeaf` returns the whole leaf
* - `getPath` returns the path from the root to this leaf
* - when defined, `notFound` can be either 'left' or 'right', it controls which key to return when it wasn't found
*
* @param {Key} key

@@ -298,3 +303,3 @@ * @param {Object} options

* @param {boolean} [options.getPath=false] - Return {val: value(s), leaf: leaf, path: pathFromRootToLeaf}
* @param {string} [options.notFound=left|right] - Return what was found left or right from key which doesn't exist
* @param {string} [options.notFound] - either 'left' or 'right' - Return what was found left or right from key which doesn't exist
* @return {Value|Value[]|Leaf|Object|Boolean}

@@ -301,0 +306,0 @@ */

{
"name": "bplustree",
"version": "1.2.1",
"version": "1.2.2",
"scripts": {

@@ -11,3 +11,3 @@ "test": "mocha --compilers js:babel-core/register --check-leaks test/bplustree.js && npm run build",

"coveralls": "npm run coverage-full && cat /home/travis/build/vhf/bplustree/coverage/lcov.info | coveralls",
"doc": "jsdoc lib -d docs",
"doc": "jsdoc -c .jsdoc lib -d docs",
"build": "babel lib -d dist"

@@ -14,0 +14,0 @@ },

@@ -7,3 +7,16 @@ /* eslint-env node, mocha */

const tree = new BPlusTree({ order: 4, debug: true });
const data = [[1, 'z'], [2, 'b'], [3, 'c'], [3, 'c2'], [4, 'd'], [5, 'e'], [6, 'f'], [6, 'g'], [8, 'h'], [10, 'm'], [11, 'n'], [12, 'p']];
const data = [
[1, 'z'],
[2, 'b'],
[3, 'c'],
[3, 'c2'],
[4, 'd'],
[5, 'e'],
[6, 'f'],
[6, 'g'],
[8, 'h'],
[10, 'm'],
[11, 'n'],
[12, 'p']
];
for (let i = 0; i < ((n || n > data.length ? data.length : n) || data.length); i++) {

@@ -139,37 +152,37 @@ tree.store(data[i][0], data[i][1]);

generator = tree.values({ key: 2, target: 'n', limit: 4 });
assert.deepEqual(generator.next(), { value: ['b'], done: false });
assert.deepEqual(generator.next(), { value: ['c', 'c2'], done: false });
assert.deepEqual(generator.next(), { value: ['d'], done: true });
assert.deepEqual(generator.next(), { value: { k: 2, v: ['b'] }, done: false });
assert.deepEqual(generator.next(), { value: { k: 3, v: ['c', 'c2'] }, done: false });
assert.deepEqual(generator.next(), { value: { k: 4, v: ['d'] }, done: true });
// limit is respected
generator = tree.values({ key: 1, limit: 1 });
assert.deepEqual(generator.next(), { value: ['z'], done: true });
assert.deepEqual(generator.next(), { value: { k: 1, v: ['z'] }, done: true });
// limit is respected
generator = tree.values({ key: 1, limit: 2 });
assert.deepEqual(generator.next(), { value: ['z'], done: false });
assert.deepEqual(generator.next(), { value: ['b'], done: true });
assert.deepEqual(generator.next(), { value: { k: 1, v: ['z'] }, done: false });
assert.deepEqual(generator.next(), { value: { k: 2, v: ['b'] }, done: true });
// limit is respected
generator = tree.values({ key: 1, limit: 3 });
assert.deepEqual(generator.next(), { value: ['z'], done: false });
assert.deepEqual(generator.next(), { value: ['b'], done: false });
assert.deepEqual(generator.next(), { value: ['c'], done: true });
assert.deepEqual(generator.next(), { value: { k: 1, v: ['z'] }, done: false });
assert.deepEqual(generator.next(), { value: { k: 2, v: ['b'] }, done: false });
assert.deepEqual(generator.next(), { value: { k: 3, v: ['c'] }, done: true });
// limit is respected although target isn't found
generator = tree.values({ key: 2, target: 'n', limit: 4 });
assert.deepEqual(generator.next(), { value: ['b'], done: false });
assert.deepEqual(generator.next(), { value: ['c', 'c2'], done: false });
assert.deepEqual(generator.next(), { value: ['d'], done: true });
assert.deepEqual(generator.next(), { value: { k: 2, v: ['b'] }, done: false });
assert.deepEqual(generator.next(), { value: { k: 3, v: ['c', 'c2'] }, done: false });
assert.deepEqual(generator.next(), { value: { k: 4, v: ['d'] }, done: true });
// target is respected before limit is reached
generator = tree.values({ key: 2, target: 'n', limit: 10 });
assert.deepEqual(generator.next(), { value: ['b'], done: false });
assert.deepEqual(generator.next(), { value: ['c', 'c2'], done: false });
assert.deepEqual(generator.next(), { value: ['d'], done: false });
assert.deepEqual(generator.next(), { value: ['e'], done: false });
assert.deepEqual(generator.next(), { value: ['f', 'g'], done: false });
assert.deepEqual(generator.next(), { value: ['h'], done: false });
assert.deepEqual(generator.next(), { value: ['m'], done: false });
assert.deepEqual(generator.next(), { value: ['n'], done: true });
assert.deepEqual(generator.next(), { value: { k: 2, v: ['b'] }, done: false });
assert.deepEqual(generator.next(), { value: { k: 3, v: ['c', 'c2'] }, done: false });
assert.deepEqual(generator.next(), { value: { k: 4, v: ['d'] }, done: false });
assert.deepEqual(generator.next(), { value: { k: 5, v: ['e'] }, done: false });
assert.deepEqual(generator.next(), { value: { k: 6, v: ['f', 'g'] }, done: false });
assert.deepEqual(generator.next(), { value: { k: 8, v: ['h'] }, done: false });
assert.deepEqual(generator.next(), { value: { k: 10, v: ['m'] }, done: false });
assert.deepEqual(generator.next(), { value: { k: 11, v: ['n'] }, done: true });

@@ -180,13 +193,14 @@ // key doesn't exist: not there

assert.deepEqual(generator.next(), { value: false, done: true });
assert.deepEqual(generator.next(), { value: undefined, done: true });
// limit is bigger than the number of remaining values
generator = tree.values({ key: 2, target: 'n', limit: 250 });
assert.deepEqual(generator.next(), { value: ['b'], done: false });
assert.deepEqual(generator.next(), { value: ['c', 'c2'], done: false });
assert.deepEqual(generator.next(), { value: ['d'], done: false });
assert.deepEqual(generator.next(), { value: ['e'], done: false });
assert.deepEqual(generator.next(), { value: ['f', 'g'], done: false });
assert.deepEqual(generator.next(), { value: ['h'], done: false });
assert.deepEqual(generator.next(), { value: ['m'], done: false });
assert.deepEqual(generator.next(), { value: ['n'], done: true });
assert.deepEqual(generator.next(), { value: { k: 2, v: ['b'] }, done: false });
assert.deepEqual(generator.next(), { value: { k: 3, v: ['c', 'c2'] }, done: false });
assert.deepEqual(generator.next(), { value: { k: 4, v: ['d'] }, done: false });
assert.deepEqual(generator.next(), { value: { k: 5, v: ['e'] }, done: false });
assert.deepEqual(generator.next(), { value: { k: 6, v: ['f', 'g'] }, done: false });
assert.deepEqual(generator.next(), { value: { k: 8, v: ['h'] }, done: false });
assert.deepEqual(generator.next(), { value: { k: 10, v: ['m'] }, done: false });
assert.deepEqual(generator.next(), { value: { k: 11, v: ['n'] }, done: true });
// continues

@@ -197,89 +211,89 @@ assert.deepEqual(generator.next(), { value: undefined, done: true });

generator = tree.values({ key: 2, target: 'zz' });
assert.deepEqual(generator.next(), { value: ['b'], done: false });
assert.deepEqual(generator.next(), { value: ['c', 'c2'], done: false });
assert.deepEqual(generator.next(), { value: ['d'], done: false });
assert.deepEqual(generator.next(), { value: ['e'], done: false });
assert.deepEqual(generator.next(), { value: ['f', 'g'], done: false });
assert.deepEqual(generator.next(), { value: ['h'], done: false });
assert.deepEqual(generator.next(), { value: ['m'], done: false });
assert.deepEqual(generator.next(), { value: ['n'], done: false });
assert.deepEqual(generator.next(), { value: ['p'], done: true });
assert.deepEqual(generator.next(), { value: { k: 2, v: ['b'] }, done: false });
assert.deepEqual(generator.next(), { value: { k: 3, v: ['c', 'c2'] }, done: false });
assert.deepEqual(generator.next(), { value: { k: 4, v: ['d'] }, done: false });
assert.deepEqual(generator.next(), { value: { k: 5, v: ['e'] }, done: false });
assert.deepEqual(generator.next(), { value: { k: 6, v: ['f', 'g'] }, done: false });
assert.deepEqual(generator.next(), { value: { k: 8, v: ['h'] }, done: false });
assert.deepEqual(generator.next(), { value: { k: 10, v: ['m'] }, done: false });
assert.deepEqual(generator.next(), { value: { k: 11, v: ['n'] }, done: false });
assert.deepEqual(generator.next(), { value: { k: 12, v: ['p'] }, done: true });
// target not found, generate until the end
generator = tree.values({ key: 8, target: 'zzz' });
assert.deepEqual(generator.next(), { value: ['h'], done: false });
assert.deepEqual(generator.next(), { value: ['m'], done: false });
assert.deepEqual(generator.next(), { value: ['n'], done: false });
assert.deepEqual(generator.next(), { value: ['p'], done: true });
assert.deepEqual(generator.next(), { value: { k: 8, v: ['h'] }, done: false });
assert.deepEqual(generator.next(), { value: { k: 10, v: ['m'] }, done: false });
assert.deepEqual(generator.next(), { value: { k: 11, v: ['n'] }, done: false });
assert.deepEqual(generator.next(), { value: { k: 12, v: ['p'] }, done: true });
// target not found, generate until limit
generator = tree.values({ key: 2, target: 'z', limit: 10 });
assert.deepEqual(generator.next(), { value: ['b'], done: false });
assert.deepEqual(generator.next(), { value: ['c', 'c2'], done: false });
assert.deepEqual(generator.next(), { value: ['d'], done: false });
assert.deepEqual(generator.next(), { value: ['e'], done: false });
assert.deepEqual(generator.next(), { value: ['f', 'g'], done: false });
assert.deepEqual(generator.next(), { value: ['h'], done: false });
assert.deepEqual(generator.next(), { value: ['m'], done: false });
assert.deepEqual(generator.next(), { value: ['n'], done: true });
assert.deepEqual(generator.next(), { value: { k: 2, v: ['b'] }, done: false });
assert.deepEqual(generator.next(), { value: { k: 3, v: ['c', 'c2'] }, done: false });
assert.deepEqual(generator.next(), { value: { k: 4, v: ['d'] }, done: false });
assert.deepEqual(generator.next(), { value: { k: 5, v: ['e'] }, done: false });
assert.deepEqual(generator.next(), { value: { k: 6, v: ['f', 'g'] }, done: false });
assert.deepEqual(generator.next(), { value: { k: 8, v: ['h'] }, done: false });
assert.deepEqual(generator.next(), { value: { k: 10, v: ['m'] }, done: false });
assert.deepEqual(generator.next(), { value: { k: 11, v: ['n'] }, done: true });
// no target
generator = tree.values({ key: 1, limit: 10 });
assert.deepEqual(generator.next(), { value: ['z'], done: false });
assert.deepEqual(generator.next(), { value: ['b'], done: false });
assert.deepEqual(generator.next(), { value: ['c', 'c2'], done: false });
assert.deepEqual(generator.next(), { value: ['d'], done: false });
assert.deepEqual(generator.next(), { value: ['e'], done: false });
assert.deepEqual(generator.next(), { value: ['f', 'g'], done: false });
assert.deepEqual(generator.next(), { value: ['h'], done: false });
assert.deepEqual(generator.next(), { value: ['m'], done: true });
assert.deepEqual(generator.next(), { value: { k: 1, v: ['z'] }, done: false });
assert.deepEqual(generator.next(), { value: { k: 2, v: ['b'] }, done: false });
assert.deepEqual(generator.next(), { value: { k: 3, v: ['c', 'c2'] }, done: false });
assert.deepEqual(generator.next(), { value: { k: 4, v: ['d'] }, done: false });
assert.deepEqual(generator.next(), { value: { k: 5, v: ['e'] }, done: false });
assert.deepEqual(generator.next(), { value: { k: 6, v: ['f', 'g'] }, done: false });
assert.deepEqual(generator.next(), { value: { k: 8, v: ['h'] }, done: false });
assert.deepEqual(generator.next(), { value: { k: 10, v: ['m'] }, done: true });
// no limit
generator = tree.values({ key: 3, target: 'n' });
assert.deepEqual(generator.next(), { value: ['c', 'c2'], done: false });
assert.deepEqual(generator.next(), { value: ['d'], done: false });
assert.deepEqual(generator.next(), { value: ['e'], done: false });
assert.deepEqual(generator.next(), { value: ['f', 'g'], done: false });
assert.deepEqual(generator.next(), { value: ['h'], done: false });
assert.deepEqual(generator.next(), { value: ['m'], done: false });
assert.deepEqual(generator.next(), { value: ['n'], done: true });
assert.deepEqual(generator.next(), { value: { k: 3, v: ['c', 'c2'] }, done: false });
assert.deepEqual(generator.next(), { value: { k: 4, v: ['d'] }, done: false });
assert.deepEqual(generator.next(), { value: { k: 5, v: ['e'] }, done: false });
assert.deepEqual(generator.next(), { value: { k: 6, v: ['f', 'g'] }, done: false });
assert.deepEqual(generator.next(), { value: { k: 8, v: ['h'] }, done: false });
assert.deepEqual(generator.next(), { value: { k: 10, v: ['m'] }, done: false });
assert.deepEqual(generator.next(), { value: { k: 11, v: ['n'] }, done: true });
// no limit
generator = tree.values({ key: 2 });
assert.deepEqual(generator.next(), { value: ['b'], done: false });
assert.deepEqual(generator.next(), { value: ['c', 'c2'], done: false });
assert.deepEqual(generator.next(), { value: ['d'], done: false });
assert.deepEqual(generator.next(), { value: ['e'], done: false });
assert.deepEqual(generator.next(), { value: ['f', 'g'], done: false });
assert.deepEqual(generator.next(), { value: ['h'], done: false });
assert.deepEqual(generator.next(), { value: ['m'], done: false });
assert.deepEqual(generator.next(), { value: ['n'], done: false });
assert.deepEqual(generator.next(), { value: ['p'], done: true });
assert.deepEqual(generator.next(), { value: { k: 2, v: ['b'] }, done: false });
assert.deepEqual(generator.next(), { value: { k: 3, v: ['c', 'c2'] }, done: false });
assert.deepEqual(generator.next(), { value: { k: 4, v: ['d'] }, done: false });
assert.deepEqual(generator.next(), { value: { k: 5, v: ['e'] }, done: false });
assert.deepEqual(generator.next(), { value: { k: 6, v: ['f', 'g'] }, done: false });
assert.deepEqual(generator.next(), { value: { k: 8, v: ['h'] }, done: false });
assert.deepEqual(generator.next(), { value: { k: 10, v: ['m'] }, done: false });
assert.deepEqual(generator.next(), { value: { k: 11, v: ['n'] }, done: false });
assert.deepEqual(generator.next(), { value: { k: 12, v: ['p'] }, done: true });
// no key, assume first key, limit respected
generator = tree.values({ target: 'n', limit: 5 });
assert.deepEqual(generator.next(), { value: ['z'], done: false });
assert.deepEqual(generator.next(), { value: ['b'], done: false });
assert.deepEqual(generator.next(), { value: ['c', 'c2'], done: false });
assert.deepEqual(generator.next(), { value: ['d'], done: true });
assert.deepEqual(generator.next(), { value: { k: 1, v: ['z'] }, done: false });
assert.deepEqual(generator.next(), { value: { k: 2, v: ['b'] }, done: false });
assert.deepEqual(generator.next(), { value: { k: 3, v: ['c', 'c2'] }, done: false });
assert.deepEqual(generator.next(), { value: { k: 4, v: ['d'] }, done: true });
// no key, assume first key, target
generator = tree.values({ target: 'd', limit: 10 });
assert.deepEqual(generator.next(), { value: ['z'], done: false });
assert.deepEqual(generator.next(), { value: ['b'], done: false });
assert.deepEqual(generator.next(), { value: ['c', 'c2'], done: false });
assert.deepEqual(generator.next(), { value: ['d'], done: true });
assert.deepEqual(generator.next(), { value: { k: 1, v: ['z'] }, done: false });
assert.deepEqual(generator.next(), { value: { k: 2, v: ['b'] }, done: false });
assert.deepEqual(generator.next(), { value: { k: 3, v: ['c', 'c2'] }, done: false });
assert.deepEqual(generator.next(), { value: { k: 4, v: ['d'] }, done: true });
// nothing, generate everything
generator = tree.values();
assert.deepEqual(generator.next(), { value: ['z'], done: false });
assert.deepEqual(generator.next(), { value: ['b'], done: false });
assert.deepEqual(generator.next(), { value: ['c', 'c2'], done: false });
assert.deepEqual(generator.next(), { value: ['d'], done: false });
assert.deepEqual(generator.next(), { value: ['e'], done: false });
assert.deepEqual(generator.next(), { value: ['f', 'g'], done: false });
assert.deepEqual(generator.next(), { value: ['h'], done: false });
assert.deepEqual(generator.next(), { value: ['m'], done: false });
assert.deepEqual(generator.next(), { value: ['n'], done: false });
assert.deepEqual(generator.next(), { value: ['p'], done: true });
assert.deepEqual(generator.next(), { value: { k: 1, v: ['z'] }, done: false });
assert.deepEqual(generator.next(), { value: { k: 2, v: ['b'] }, done: false });
assert.deepEqual(generator.next(), { value: { k: 3, v: ['c', 'c2'] }, done: false });
assert.deepEqual(generator.next(), { value: { k: 4, v: ['d'] }, done: false });
assert.deepEqual(generator.next(), { value: { k: 5, v: ['e'] }, done: false });
assert.deepEqual(generator.next(), { value: { k: 6, v: ['f', 'g'] }, done: false });
assert.deepEqual(generator.next(), { value: { k: 8, v: ['h'] }, done: false });
assert.deepEqual(generator.next(), { value: { k: 10, v: ['m'] }, done: false });
assert.deepEqual(generator.next(), { value: { k: 11, v: ['n'] }, done: false });
assert.deepEqual(generator.next(), { value: { k: 12, v: ['p'] }, done: true });

@@ -294,33 +308,33 @@ tree = new BPlusTree({ order: 6, debug: true });

generator = tree.values({ key: 1, limit: 1 });
assert.deepEqual(generator.next(), { value: ['z'], done: true });
assert.deepEqual(generator.next(), { value: { k: 1, v: ['z'] }, done: true });
// limit is respected
generator = tree.values({ key: 1, limit: 2 });
assert.deepEqual(generator.next(), { value: ['z'], done: false });
assert.deepEqual(generator.next(), { value: ['b'], done: true });
assert.deepEqual(generator.next(), { value: { k: 1, v: ['z'] }, done: false });
assert.deepEqual(generator.next(), { value: { k: 2, v: ['b'] }, done: true });
// limit is respected
generator = tree.values({ key: 1, limit: 3 });
assert.deepEqual(generator.next(), { value: ['z'], done: false });
assert.deepEqual(generator.next(), { value: ['b', 'b2'], done: true });
assert.deepEqual(generator.next(), { value: { k: 1, v: ['z'] }, done: false });
assert.deepEqual(generator.next(), { value: { k: 2, v: ['b', 'b2'] }, done: true });
// limit is respected
generator = tree.values({ key: 1, limit: 4 });
assert.deepEqual(generator.next(), { value: ['z'], done: false });
assert.deepEqual(generator.next(), { value: ['b', 'b2', 'b3'], done: true });
assert.deepEqual(generator.next(), { value: { k: 1, v: ['z'] }, done: false });
assert.deepEqual(generator.next(), { value: { k: 2, v: ['b', 'b2', 'b3'] }, done: true });
// limit is respected
generator = tree.values({ key: 1, limit: 5 });
assert.deepEqual(generator.next(), { value: ['z'], done: false });
assert.deepEqual(generator.next(), { value: ['b', 'b2', 'b3', 'b4'], done: true });
assert.deepEqual(generator.next(), { value: { k: 1, v: ['z'] }, done: false });
assert.deepEqual(generator.next(), { value: { k: 2, v: ['b', 'b2', 'b3', 'b4'] }, done: true });
// limit is respected
generator = tree.values({ key: 1, limit: 6 });
assert.deepEqual(generator.next(), { value: ['z'], done: false });
assert.deepEqual(generator.next(), { value: ['b', 'b2', 'b3', 'b4'], done: false });
assert.deepEqual(generator.next(), { value: ['e'], done: true });
assert.deepEqual(generator.next(), { value: { k: 1, v: ['z'] }, done: false });
assert.deepEqual(generator.next(), { value: { k: 2, v: ['b', 'b2', 'b3', 'b4'] }, done: false });
assert.deepEqual(generator.next(), { value: { k: 5, v: ['e'] }, done: true });
// limit is respected
generator = tree.values({ key: 2, limit: 2 });
assert.deepEqual(generator.next(), { value: ['b', 'b2'], done: true });
assert.deepEqual(generator.next(), { value: { k: 2, v: ['b', 'b2'] }, done: true });
});

@@ -327,0 +341,0 @@

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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