Comparing version 1.1.0 to 1.1.1
@@ -63,3 +63,5 @@ 'use strict'; | ||
} else if (options.getValues) { | ||
result.push(node.v[i]); | ||
result = result.concat(node.v[i].reduce(function (a, b) { | ||
return a.concat(b); | ||
}, [])); | ||
} else { | ||
@@ -66,0 +68,0 @@ result[node.k[i]] = node.v[i]; |
@@ -38,3 +38,3 @@ /** Class representing a B+ Tree. */ | ||
options || (options = {}); | ||
const result = (options.getKeys || options.getValues) ? [] : {}; | ||
let result = (options.getKeys || options.getValues) ? [] : {}; | ||
function walk(node) { | ||
@@ -51,3 +51,3 @@ if (node.t === 'branch') { | ||
} else if (options.getValues) { | ||
result.push(node.v[i]); | ||
result = result.concat(node.v[i].reduce((a, b) => a.concat(b), [])); | ||
} else { | ||
@@ -54,0 +54,0 @@ result[node.k[i]] = node.v[i]; |
{ | ||
"name": "bplustree", | ||
"version": "1.1.0", | ||
"version": "1.1.1", | ||
"scripts": { | ||
@@ -5,0 +5,0 @@ "test": "mocha --compilers js:babel-core/register --check-leaks test/bplustree.js && npm run build", |
@@ -116,2 +116,4 @@ /* eslint-env node, mocha */ | ||
assert.deepEqual(tree.repr(), { '1': ['z'], '2': ['b'], '3': ['c', 'c2'], '4': ['d'], '5': ['e'], '6': ['f'], '7': ['g'], '8': ['h'], '10': ['m'], '11': ['n'], '12': ['p'] }); | ||
assert.deepEqual(tree.repr({ getKeys: true }), ['1', '2', '3', '4', '5', '6', '7', '8', '10', '11', '12']); | ||
assert.deepEqual(tree.repr({ getValues: true }), ['z', 'b', 'c', 'c2', 'd', 'e', 'f', 'g', 'h', 'm', 'n', 'p']); | ||
}); | ||
@@ -118,0 +120,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
1120666
2084