Comparing version 3.0.6 to 4.0.0
@@ -6,3 +6,2 @@ 'use strict' | ||
var onlyRegex = require('./onlyRegex') | ||
var reverseSort = require('./reverseSort') | ||
@@ -17,3 +16,3 @@ function Bucket (parent) { | ||
Bucket.prototype.add = function (set) { | ||
sorted.add(this.data, set, this.weight !== set.weight ? this._algo : reverseSort) | ||
sorted.add(this.data, set, this._algo) | ||
@@ -20,0 +19,0 @@ if (this._isDeep) { |
{ | ||
"name": "bloomrun", | ||
"version": "3.0.6", | ||
"version": "4.0.0", | ||
"description": "JS object pattern matching", | ||
@@ -8,3 +8,3 @@ "main": "bloomrun.js", | ||
"bench": "node bench.js", | ||
"test": "standard | snazzy && tape test.js | faucet", | ||
"test": "standard | snazzy && tape test.js | tap-spec", | ||
"zuul-local": "zuul --open --local 8081 -- test.js", | ||
@@ -28,8 +28,8 @@ "coverage": "istanbul cover tape test.js > /dev/null; open coverage/lcov-report/index.html", | ||
"fastbench": "^1.0.0", | ||
"faucet": "0.0.1", | ||
"istanbul": "^0.4.1", | ||
"patrun": "^0.5.0", | ||
"pre-commit": "^1.1.1", | ||
"snazzy": "^6.0.0", | ||
"standard": "^10.0.0", | ||
"snazzy": "^7.0.0", | ||
"standard": "^10.0.3", | ||
"tap-spec": "^4.1.1", | ||
"tape": "^4.8.0", | ||
@@ -36,0 +36,0 @@ "zuul": "^3.11.1" |
@@ -80,3 +80,3 @@ [![logo][logo-url]][npm-url] | ||
overlaps. If multiple matching patterns overlaps it checks on the | ||
first overlapping group of patterns that matches. | ||
first overlapping group of patterns that matches. The insertion order of pattern with the same depth is not guaranteed. | ||
@@ -199,3 +199,3 @@ ------------------------------------------------------- | ||
Copyright Matteo Collina 2015-2016, Licensed under [MIT][]. | ||
Copyright Matteo Collina 2015-2017, Licensed under [MIT][]. | ||
@@ -202,0 +202,0 @@ [MIT]: ./LICENSE |
20
test.js
@@ -525,18 +525,14 @@ 'use strict' | ||
test('depth indexing preserves insertion order for same pattern', function (t) { | ||
t.plan(1) | ||
test('issue#55 - unexpected behaviour using indexing:depth', function (t) { | ||
t.plan(2) | ||
var instance = bloomrun({ indexing: 'depth' }) | ||
var pattern = { group: '123', another: 'value' } | ||
instance.add({ role: 'tag', cmd: 'find' }, 'tag,find') | ||
instance.add({ role: 'location', cmd: 'find' }, 'location,find') | ||
function payloadOne () { } | ||
function payloadTwo () { } | ||
instance.add({ role: 'tag', cmd: 'find', count: /.*/ }, 'tag,find,count') | ||
instance.add({ role: 'location', cmd: 'find', count: /.*/ }, 'location,find,count') | ||
instance.add(pattern, payloadOne) | ||
instance.add(pattern, payloadTwo) | ||
t.deepEqual(instance.list({ group: '123', another: 'value' }), [ | ||
payloadOne, | ||
payloadTwo | ||
]) | ||
t.deepEqual(instance.lookup({ role: 'location', cmd: 'find', count: 'true' }), 'location,find,count') | ||
t.deepEqual(instance.lookup({ role: 'location', cmd: 'find' }), 'location,find') | ||
}) | ||
@@ -543,0 +539,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
1057
39093
19