Comparing version 3.7.1 to 3.8.0
@@ -16,2 +16,3 @@ const Nanoiterator = require('nanoiterator') | ||
this._order = (opts && opts.reverse) ? REVERSE_SORT_ORDER : SORT_ORDER | ||
this._random = !!(opts && opts.random) | ||
this._start = 0 | ||
@@ -57,5 +58,6 @@ this._end = 0 | ||
const bucket = top.node.trie[i] || [] | ||
const order = this._random ? randomOrder() : this._order | ||
for (j = 0; j < this._order.length; j++) { | ||
var val = this._order[j] | ||
for (j = 0; j < order.length; j++) { | ||
var val = order[j] | ||
if (val !== 4 || !this._gt || i !== this._start) { | ||
@@ -128,1 +130,12 @@ const len = this._stack.length | ||
} | ||
function randomOrder () { | ||
const order = [0, 1, 2, 3, 4] | ||
for (let i = 0; i < order.length - 1; i++) { | ||
const n = i + Math.floor(Math.random() * (order.length - i)) | ||
const tmp = order[i] | ||
order[i] = order[n] | ||
order[n] = tmp | ||
} | ||
return order | ||
} |
{ | ||
"name": "hypertrie", | ||
"version": "3.7.1", | ||
"version": "3.8.0", | ||
"description": "Distributed single writer key/value store", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -142,3 +142,4 @@ # hypertrie | ||
{ | ||
recursive: true | ||
recursive: true, | ||
random: false // does a random order iteration | ||
} | ||
@@ -145,0 +146,0 @@ ``` |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
97258
3032
218