Comparing version 0.5.3 to 0.6.0
@@ -0,10 +1,10 @@ | ||
/*globals options: false */ | ||
/*jslint node: true */ | ||
"use strict"; | ||
var Qlobber = require('..').Qlobber, | ||
common = require('./common'); | ||
var common = require('./common'); | ||
module.exports = function () | ||
{ | ||
var matcher = new Qlobber(); | ||
var matcher = new options.Matcher(); | ||
@@ -11,0 +11,0 @@ common.add_bindings(matcher); |
@@ -9,2 +9,3 @@ /*globals rabbitmq_test_bindings: false, | ||
var qlobber = require('../..'); | ||
var expect = require('chai').expect; | ||
@@ -23,2 +24,4 @@ require('../../test/rabbitmq.js'); | ||
exports.remove_duplicates = remove_duplicates; | ||
exports.add_bindings = function(matcher) | ||
@@ -44,5 +47,15 @@ { | ||
if (options.Matcher === qlobber.Qlobber) | ||
{ | ||
vals = remove_duplicates(vals); | ||
} | ||
if (options.check) | ||
{ | ||
expect(remove_duplicates(vals)).to.eql(test[1].sort()); | ||
if (options.Matcher === qlobber.QlobberDedup) | ||
{ | ||
vals = Array.from(vals).sort(); | ||
} | ||
expect(vals).to.eql(test[1].sort()); | ||
} | ||
@@ -54,3 +67,3 @@ } | ||
{ | ||
var i, r, test; | ||
var i, r, test, vals; | ||
@@ -68,3 +81,14 @@ for (i = 0; i < rabbitmq_bindings_to_remove.length; i += 1) | ||
test = rabbitmq_expected_results_after_remove[i]; | ||
expect(remove_duplicates(matcher.match(test[0]))).to.eql(test[1].sort()); | ||
vals = matcher.match(test[0]); | ||
if (options.Matcher === qlobber.Qlobber) | ||
{ | ||
vals = remove_duplicates(vals); | ||
} | ||
else | ||
{ | ||
vals = Array.from(vals).sort(); | ||
} | ||
expect(vals).to.eql(test[1].sort()); | ||
} | ||
@@ -71,0 +95,0 @@ } |
@@ -0,14 +1,18 @@ | ||
/*globals options: false */ | ||
/*jslint node: true */ | ||
"use strict"; | ||
var Qlobber = require('..').Qlobber, | ||
var qlobber = require('..'), | ||
common = require('./common'); | ||
var matcher = new Qlobber(); | ||
common.add_bindings(matcher); | ||
var matcher_default = new qlobber.Qlobber(); | ||
common.add_bindings(matcher_default); | ||
var matcher_dedup = new qlobber.QlobberDedup(); | ||
common.add_bindings(matcher_dedup); | ||
module.exports = function () | ||
{ | ||
common.match(matcher); | ||
common.match(options.Matcher === qlobber.Qlobber ? matcher_default : matcher_dedup); | ||
}; | ||
/*jslint node: true */ | ||
var qlobber = require('../..'); | ||
module.exports = { | ||
Matcher: qlobber.Qlobber, | ||
check: true | ||
}; |
/*jslint node: true */ | ||
var qlobber = require('../..'); | ||
module.exports = { | ||
Matcher: qlobber.Qlobber, | ||
check: false | ||
}; |
@@ -1,1 +0,1 @@ | ||
{"/home/david/Private/hub/common/qlobber/Gruntfile.js":{"path":"/home/david/Private/hub/common/qlobber/Gruntfile.js","s":{"1":1,"2":1,"3":2,"4":2,"5":3,"6":2,"7":2,"8":2,"9":1,"10":2,"11":2,"12":1,"13":1,"14":1,"15":1,"16":1,"17":1,"18":1,"19":1,"20":1,"21":1,"22":1,"23":1,"24":1,"25":1,"26":1,"27":1},"b":{"1":[2,1],"2":[1,1]},"f":{"1":2,"2":1},"fnMap":{"1":{"name":"(anonymous_1)","line":11,"loc":{"start":{"line":11,"column":21},"end":{"line":12,"column":0}}},"2":{"name":"(anonymous_2)","line":39,"loc":{"start":{"line":39,"column":17},"end":{"line":40,"column":0}}}},"statementMap":{"1":{"start":{"line":8,"column":0},"end":{"line":9,"column":39}},"2":{"start":{"line":11,"column":0},"end":{"line":33,"column":2}},"3":{"start":{"line":13,"column":4},"end":{"line":13,"column":51}},"4":{"start":{"line":15,"column":4},"end":{"line":30,"column":5}},"5":{"start":{"line":17,"column":8},"end":{"line":29,"column":9}},"6":{"start":{"line":19,"column":12},"end":{"line":19,"column":32}},"7":{"start":{"line":21,"column":12},"end":{"line":21,"column":33}},"8":{"start":{"line":23,"column":12},"end":{"line":26,"column":13}},"9":{"start":{"line":25,"column":16},"end":{"line":25,"column":47}},"10":{"start":{"line":28,"column":12},"end":{"line":28,"column":18}},"11":{"start":{"line":32,"column":4},"end":{"line":32,"column":48}},"12":{"start":{"line":36,"column":0},"end":{"line":36,"column":78}},"13":{"start":{"line":37,"column":0},"end":{"line":37,"column":96}},"14":{"start":{"line":39,"column":0},"end":{"line":99,"column":2}},"15":{"start":{"line":41,"column":4},"end":{"line":84,"column":7}},"16":{"start":{"line":86,"column":4},"end":{"line":86,"column":39}},"17":{"start":{"line":87,"column":4},"end":{"line":87,"column":43}},"18":{"start":{"line":88,"column":4},"end":{"line":88,"column":39}},"19":{"start":{"line":89,"column":4},"end":{"line":89,"column":37}},"20":{"start":{"line":91,"column":4},"end":{"line":91,"column":45}},"21":{"start":{"line":92,"column":4},"end":{"line":92,"column":44}},"22":{"start":{"line":93,"column":4},"end":{"line":93,"column":41}},"23":{"start":{"line":94,"column":4},"end":{"line":94,"column":71}},"24":{"start":{"line":95,"column":4},"end":{"line":95,"column":54}},"25":{"start":{"line":96,"column":4},"end":{"line":96,"column":46}},"26":{"start":{"line":97,"column":4},"end":{"line":97,"column":58}},"27":{"start":{"line":98,"column":4},"end":{"line":98,"column":59}}},"branchMap":{"1":{"line":17,"type":"if","locations":[{"start":{"line":17,"column":8},"end":{"line":17,"column":8}},{"start":{"line":17,"column":8},"end":{"line":17,"column":8}}]},"2":{"line":23,"type":"if","locations":[{"start":{"line":23,"column":12},"end":{"line":23,"column":12}},{"start":{"line":23,"column":12},"end":{"line":23,"column":12}}]}}},"/home/david/Private/hub/common/qlobber/index.js":{"path":"/home/david/Private/hub/common/qlobber/index.js","s":{"1":1},"b":{},"f":{},"fnMap":{},"statementMap":{"1":{"start":{"line":3,"column":0},"end":{"line":3,"column":42}}},"branchMap":{}},"/home/david/Private/hub/common/qlobber/lib/qlobber.js":{"path":"/home/david/Private/hub/common/qlobber/lib/qlobber.js","s":{"1":1,"2":12,"3":12,"4":12,"5":12,"6":12,"7":1,"8":569,"9":569,"10":165,"11":165,"12":6,"13":159,"14":165,"15":404,"16":404,"17":404,"18":203,"19":404,"20":1,"21":111,"22":111,"23":33,"24":33,"25":32,"26":5,"27":27,"28":27,"29":26,"30":32,"31":30,"32":33,"33":78,"34":78,"35":78,"36":1,"37":77,"38":77,"39":43,"40":34,"41":1,"42":972,"43":972,"44":1174,"45":1174,"46":260,"47":464,"48":260,"49":972,"50":1,"51":1017,"52":1017,"53":1019,"54":1017,"55":1,"56":1911,"57":1911,"58":1911,"59":972,"60":972,"61":1911,"62":1112,"63":1112,"64":1017,"65":799,"66":799,"67":797,"68":797,"69":154,"70":799,"71":785,"72":785,"73":256,"74":1911,"75":1,"76":165,"77":165,"78":1,"79":34,"80":34,"81":1,"82":65,"83":1,"84":1,"85":1,"86":1,"87":4,"88":1},"b":{"1":[12,11],"2":[12,11],"3":[12,11],"4":[12,11],"5":[165,404],"6":[6,159],"7":[203,201],"8":[33,78],"9":[32,1],"10":[5,27],"11":[26,1],"12":[30,2],"13":[1,77],"14":[260,914],"15":[972,939],"16":[1112,799],"17":[1017,95],"18":[797,2],"19":[799,798],"20":[154,643],"21":[785,14],"22":[256,529]},"f":{"1":12,"2":569,"3":111,"4":972,"5":1017,"6":1911,"7":165,"8":34,"9":65,"10":1,"11":4},"fnMap":{"1":{"name":"Qlobber","line":113,"loc":{"start":{"line":113,"column":0},"end":{"line":114,"column":0}}},"2":{"name":"(anonymous_2)","line":123,"loc":{"start":{"line":123,"column":25},"end":{"line":124,"column":0}}},"3":{"name":"(anonymous_3)","line":154,"loc":{"start":{"line":154,"column":28},"end":{"line":155,"column":0}}},"4":{"name":"forInRep","line":207,"loc":{"start":{"line":207,"column":0},"end":{"line":207,"column":41}}},"5":{"name":"addAll","line":227,"loc":{"start":{"line":227,"column":0},"end":{"line":227,"column":30}}},"6":{"name":"(anonymous_6)","line":237,"loc":{"start":{"line":237,"column":27},"end":{"line":238,"column":0}}},"7":{"name":"(anonymous_7)","line":298,"loc":{"start":{"line":298,"column":24},"end":{"line":299,"column":0}}},"8":{"name":"(anonymous_8)","line":311,"loc":{"start":{"line":311,"column":27},"end":{"line":312,"column":0}}},"9":{"name":"(anonymous_9)","line":323,"loc":{"start":{"line":323,"column":26},"end":{"line":324,"column":0}}},"10":{"name":"(anonymous_10)","line":335,"loc":{"start":{"line":335,"column":26},"end":{"line":336,"column":0}}},"11":{"name":"(anonymous_11)","line":342,"loc":{"start":{"line":342,"column":29},"end":{"line":343,"column":0}}}},"statementMap":{"1":{"start":{"line":113,"column":0},"end":{"line":121,"column":1}},"2":{"start":{"line":115,"column":4},"end":{"line":115,"column":28}},"3":{"start":{"line":117,"column":4},"end":{"line":117,"column":47}},"4":{"start":{"line":118,"column":4},"end":{"line":118,"column":53}},"5":{"start":{"line":119,"column":4},"end":{"line":119,"column":55}},"6":{"start":{"line":120,"column":4},"end":{"line":120,"column":20}},"7":{"start":{"line":123,"column":0},"end":{"line":152,"column":2}},"8":{"start":{"line":125,"column":4},"end":{"line":125,"column":17}},"9":{"start":{"line":127,"column":4},"end":{"line":141,"column":5}},"10":{"start":{"line":129,"column":8},"end":{"line":129,"column":39}},"11":{"start":{"line":131,"column":8},"end":{"line":138,"column":9}},"12":{"start":{"line":133,"column":12},"end":{"line":133,"column":32}},"13":{"start":{"line":137,"column":12},"end":{"line":137,"column":46}},"14":{"start":{"line":140,"column":8},"end":{"line":140,"column":15}},"15":{"start":{"line":143,"column":4},"end":{"line":143,"column":20}},"16":{"start":{"line":144,"column":4},"end":{"line":144,"column":24}},"17":{"start":{"line":146,"column":4},"end":{"line":149,"column":5}},"18":{"start":{"line":148,"column":8},"end":{"line":148,"column":33}},"19":{"start":{"line":151,"column":4},"end":{"line":151,"column":37}},"20":{"start":{"line":154,"column":0},"end":{"line":205,"column":2}},"21":{"start":{"line":156,"column":4},"end":{"line":156,"column":24}},"22":{"start":{"line":158,"column":4},"end":{"line":185,"column":5}},"23":{"start":{"line":160,"column":8},"end":{"line":160,"column":39}},"24":{"start":{"line":162,"column":8},"end":{"line":182,"column":9}},"25":{"start":{"line":164,"column":12},"end":{"line":176,"column":13}},"26":{"start":{"line":166,"column":16},"end":{"line":166,"column":24}},"27":{"start":{"line":170,"column":16},"end":{"line":170,"column":44}},"28":{"start":{"line":172,"column":16},"end":{"line":175,"column":17}},"29":{"start":{"line":174,"column":20},"end":{"line":174,"column":40}},"30":{"start":{"line":178,"column":12},"end":{"line":181,"column":13}},"31":{"start":{"line":180,"column":16},"end":{"line":180,"column":49}},"32":{"start":{"line":184,"column":8},"end":{"line":184,"column":15}},"33":{"start":{"line":187,"column":4},"end":{"line":187,"column":20}},"34":{"start":{"line":188,"column":4},"end":{"line":188,"column":24}},"35":{"start":{"line":190,"column":4},"end":{"line":193,"column":5}},"36":{"start":{"line":192,"column":8},"end":{"line":192,"column":15}},"37":{"start":{"line":195,"column":4},"end":{"line":195,"column":40}},"38":{"start":{"line":198,"column":4},"end":{"line":201,"column":5}},"39":{"start":{"line":200,"column":8},"end":{"line":200,"column":15}},"40":{"start":{"line":204,"column":4},"end":{"line":204,"column":26}},"41":{"start":{"line":207,"column":0},"end":{"line":225,"column":1}},"42":{"start":{"line":209,"column":2},"end":{"line":209,"column":46}},"43":{"start":{"line":211,"column":2},"end":{"line":222,"column":3}},"44":{"start":{"line":213,"column":4},"end":{"line":213,"column":16}},"45":{"start":{"line":214,"column":4},"end":{"line":221,"column":5}},"46":{"start":{"line":216,"column":8},"end":{"line":219,"column":9}},"47":{"start":{"line":218,"column":10},"end":{"line":218,"column":43}},"48":{"start":{"line":220,"column":8},"end":{"line":220,"column":14}},"49":{"start":{"line":224,"column":2},"end":{"line":224,"column":11}},"50":{"start":{"line":227,"column":0},"end":{"line":235,"column":1}},"51":{"start":{"line":228,"column":2},"end":{"line":228,"column":64}},"52":{"start":{"line":230,"column":2},"end":{"line":232,"column":3}},"53":{"start":{"line":231,"column":4},"end":{"line":231,"column":37}},"54":{"start":{"line":234,"column":2},"end":{"line":234,"column":14}},"55":{"start":{"line":237,"column":0},"end":{"line":287,"column":2}},"56":{"start":{"line":239,"column":4},"end":{"line":239,"column":17}},"57":{"start":{"line":241,"column":4},"end":{"line":241,"column":39}},"58":{"start":{"line":243,"column":4},"end":{"line":250,"column":5}},"59":{"start":{"line":247,"column":8},"end":{"line":247,"column":44}},"60":{"start":{"line":249,"column":8},"end":{"line":249,"column":52}},"61":{"start":{"line":252,"column":4},"end":{"line":284,"column":5}},"62":{"start":{"line":254,"column":8},"end":{"line":254,"column":39}},"63":{"start":{"line":256,"column":8},"end":{"line":259,"column":9}},"64":{"start":{"line":258,"column":12},"end":{"line":258,"column":30}},"65":{"start":{"line":263,"column":8},"end":{"line":263,"column":24}},"66":{"start":{"line":265,"column":8},"end":{"line":273,"column":9}},"67":{"start":{"line":267,"column":12},"end":{"line":267,"column":32}},"68":{"start":{"line":269,"column":12},"end":{"line":272,"column":13}},"69":{"start":{"line":271,"column":16},"end":{"line":271,"column":53}},"70":{"start":{"line":275,"column":8},"end":{"line":283,"column":9}},"71":{"start":{"line":277,"column":12},"end":{"line":277,"column":46}},"72":{"start":{"line":279,"column":12},"end":{"line":282,"column":13}},"73":{"start":{"line":281,"column":16},"end":{"line":281,"column":53}},"74":{"start":{"line":286,"column":4},"end":{"line":286,"column":13}},"75":{"start":{"line":298,"column":0},"end":{"line":302,"column":2}},"76":{"start":{"line":300,"column":4},"end":{"line":300,"column":64}},"77":{"start":{"line":301,"column":4},"end":{"line":301,"column":16}},"78":{"start":{"line":311,"column":0},"end":{"line":315,"column":2}},"79":{"start":{"line":313,"column":4},"end":{"line":313,"column":67}},"80":{"start":{"line":314,"column":4},"end":{"line":314,"column":16}},"81":{"start":{"line":323,"column":0},"end":{"line":326,"column":2}},"82":{"start":{"line":325,"column":4},"end":{"line":325,"column":72}},"83":{"start":{"line":335,"column":0},"end":{"line":339,"column":2}},"84":{"start":{"line":337,"column":4},"end":{"line":337,"column":20}},"85":{"start":{"line":338,"column":4},"end":{"line":338,"column":16}},"86":{"start":{"line":342,"column":0},"end":{"line":345,"column":2}},"87":{"start":{"line":344,"column":4},"end":{"line":344,"column":22}},"88":{"start":{"line":347,"column":0},"end":{"line":347,"column":26}}},"branchMap":{"1":{"line":115,"type":"binary-expr","locations":[{"start":{"line":115,"column":14},"end":{"line":115,"column":21}},{"start":{"line":115,"column":25},"end":{"line":115,"column":27}}]},"2":{"line":117,"type":"binary-expr","locations":[{"start":{"line":117,"column":22},"end":{"line":117,"column":39}},{"start":{"line":117,"column":43},"end":{"line":117,"column":46}}]},"3":{"line":118,"type":"binary-expr","locations":[{"start":{"line":118,"column":25},"end":{"line":118,"column":45}},{"start":{"line":118,"column":49},"end":{"line":118,"column":52}}]},"4":{"line":119,"type":"binary-expr","locations":[{"start":{"line":119,"column":26},"end":{"line":119,"column":47}},{"start":{"line":119,"column":51},"end":{"line":119,"column":54}}]},"5":{"line":127,"type":"if","locations":[{"start":{"line":127,"column":4},"end":{"line":127,"column":4}},{"start":{"line":127,"column":4},"end":{"line":127,"column":4}}]},"6":{"line":131,"type":"if","locations":[{"start":{"line":131,"column":8},"end":{"line":131,"column":8}},{"start":{"line":131,"column":8},"end":{"line":131,"column":8}}]},"7":{"line":146,"type":"if","locations":[{"start":{"line":146,"column":4},"end":{"line":146,"column":4}},{"start":{"line":146,"column":4},"end":{"line":146,"column":4}}]},"8":{"line":158,"type":"if","locations":[{"start":{"line":158,"column":4},"end":{"line":158,"column":4}},{"start":{"line":158,"column":4},"end":{"line":158,"column":4}}]},"9":{"line":162,"type":"if","locations":[{"start":{"line":162,"column":8},"end":{"line":162,"column":8}},{"start":{"line":162,"column":8},"end":{"line":162,"column":8}}]},"10":{"line":164,"type":"if","locations":[{"start":{"line":164,"column":12},"end":{"line":164,"column":12}},{"start":{"line":164,"column":12},"end":{"line":164,"column":12}}]},"11":{"line":172,"type":"if","locations":[{"start":{"line":172,"column":16},"end":{"line":172,"column":16}},{"start":{"line":172,"column":16},"end":{"line":172,"column":16}}]},"12":{"line":178,"type":"if","locations":[{"start":{"line":178,"column":12},"end":{"line":178,"column":12}},{"start":{"line":178,"column":12},"end":{"line":178,"column":12}}]},"13":{"line":190,"type":"if","locations":[{"start":{"line":190,"column":4},"end":{"line":190,"column":4}},{"start":{"line":190,"column":4},"end":{"line":190,"column":4}}]},"14":{"line":214,"type":"if","locations":[{"start":{"line":214,"column":4},"end":{"line":214,"column":4}},{"start":{"line":214,"column":4},"end":{"line":214,"column":4}}]},"15":{"line":243,"type":"if","locations":[{"start":{"line":243,"column":4},"end":{"line":243,"column":4}},{"start":{"line":243,"column":4},"end":{"line":243,"column":4}}]},"16":{"line":252,"type":"if","locations":[{"start":{"line":252,"column":4},"end":{"line":252,"column":4}},{"start":{"line":252,"column":4},"end":{"line":252,"column":4}}]},"17":{"line":256,"type":"if","locations":[{"start":{"line":256,"column":8},"end":{"line":256,"column":8}},{"start":{"line":256,"column":8},"end":{"line":256,"column":8}}]},"18":{"line":265,"type":"if","locations":[{"start":{"line":265,"column":8},"end":{"line":265,"column":8}},{"start":{"line":265,"column":8},"end":{"line":265,"column":8}}]},"19":{"line":265,"type":"binary-expr","locations":[{"start":{"line":265,"column":13},"end":{"line":265,"column":40}},{"start":{"line":265,"column":46},"end":{"line":265,"column":74}}]},"20":{"line":269,"type":"if","locations":[{"start":{"line":269,"column":12},"end":{"line":269,"column":12}},{"start":{"line":269,"column":12},"end":{"line":269,"column":12}}]},"21":{"line":275,"type":"if","locations":[{"start":{"line":275,"column":8},"end":{"line":275,"column":8}},{"start":{"line":275,"column":8},"end":{"line":275,"column":8}}]},"22":{"line":279,"type":"if","locations":[{"start":{"line":279,"column":12},"end":{"line":279,"column":12}},{"start":{"line":279,"column":12},"end":{"line":279,"column":12}}]}}}} | ||
{"/home/david/qlobber/Gruntfile.js":{"path":"/home/david/qlobber/Gruntfile.js","s":{"1":1,"2":1,"3":2,"4":2,"5":3,"6":2,"7":2,"8":2,"9":1,"10":2,"11":2,"12":1,"13":1,"14":1,"15":1,"16":1,"17":1,"18":1,"19":1,"20":1,"21":1,"22":1,"23":1,"24":1,"25":1,"26":1,"27":1,"28":1,"29":1},"b":{"1":[2,1],"2":[1,1]},"f":{"1":2,"2":1},"fnMap":{"1":{"name":"(anonymous_1)","line":11,"loc":{"start":{"line":11,"column":21},"end":{"line":12,"column":0}}},"2":{"name":"(anonymous_2)","line":39,"loc":{"start":{"line":39,"column":17},"end":{"line":40,"column":0}}}},"statementMap":{"1":{"start":{"line":8,"column":0},"end":{"line":9,"column":39}},"2":{"start":{"line":11,"column":0},"end":{"line":33,"column":2}},"3":{"start":{"line":13,"column":4},"end":{"line":13,"column":51}},"4":{"start":{"line":15,"column":4},"end":{"line":30,"column":5}},"5":{"start":{"line":17,"column":8},"end":{"line":29,"column":9}},"6":{"start":{"line":19,"column":12},"end":{"line":19,"column":32}},"7":{"start":{"line":21,"column":12},"end":{"line":21,"column":33}},"8":{"start":{"line":23,"column":12},"end":{"line":26,"column":13}},"9":{"start":{"line":25,"column":16},"end":{"line":25,"column":47}},"10":{"start":{"line":28,"column":12},"end":{"line":28,"column":18}},"11":{"start":{"line":32,"column":4},"end":{"line":32,"column":48}},"12":{"start":{"line":36,"column":0},"end":{"line":36,"column":78}},"13":{"start":{"line":37,"column":0},"end":{"line":37,"column":96}},"14":{"start":{"line":39,"column":0},"end":{"line":111,"column":2}},"15":{"start":{"line":41,"column":4},"end":{"line":92,"column":7}},"16":{"start":{"line":94,"column":4},"end":{"line":94,"column":39}},"17":{"start":{"line":95,"column":4},"end":{"line":95,"column":43}},"18":{"start":{"line":96,"column":4},"end":{"line":96,"column":39}},"19":{"start":{"line":97,"column":4},"end":{"line":97,"column":37}},"20":{"start":{"line":99,"column":4},"end":{"line":99,"column":45}},"21":{"start":{"line":100,"column":4},"end":{"line":100,"column":44}},"22":{"start":{"line":101,"column":4},"end":{"line":101,"column":41}},"23":{"start":{"line":102,"column":4},"end":{"line":102,"column":71}},"24":{"start":{"line":103,"column":4},"end":{"line":103,"column":54}},"25":{"start":{"line":104,"column":4},"end":{"line":106,"column":59}},"26":{"start":{"line":107,"column":4},"end":{"line":107,"column":58}},"27":{"start":{"line":108,"column":4},"end":{"line":108,"column":64}},"28":{"start":{"line":109,"column":4},"end":{"line":109,"column":68}},"29":{"start":{"line":110,"column":4},"end":{"line":110,"column":59}}},"branchMap":{"1":{"line":17,"type":"if","locations":[{"start":{"line":17,"column":8},"end":{"line":17,"column":8}},{"start":{"line":17,"column":8},"end":{"line":17,"column":8}}]},"2":{"line":23,"type":"if","locations":[{"start":{"line":23,"column":12},"end":{"line":23,"column":12}},{"start":{"line":23,"column":12},"end":{"line":23,"column":12}}]}}},"/home/david/qlobber/index.js":{"path":"/home/david/qlobber/index.js","s":{"1":1},"b":{},"f":{},"fnMap":{},"statementMap":{"1":{"start":{"line":3,"column":0},"end":{"line":3,"column":42}}},"branchMap":{}},"/home/david/qlobber/lib/qlobber.js":{"path":"/home/david/qlobber/lib/qlobber.js","s":{"1":1,"2":1,"3":27,"4":27,"5":27,"6":27,"7":27,"8":1,"9":165,"10":1,"11":360000,"12":1,"13":1013,"14":1013,"15":121013,"16":1,"17":27,"18":27,"19":26,"20":27,"21":1,"22":4321147,"23":4321147,"24":720333,"25":720333,"26":720001,"27":332,"28":720333,"29":3600814,"30":3600814,"31":3600814,"32":429,"33":3600814,"34":1,"35":222,"36":222,"37":66,"38":66,"39":60,"40":66,"41":156,"42":156,"43":156,"44":2,"45":154,"46":154,"47":86,"48":68,"49":1,"50":1944,"51":1944,"52":2348,"53":2348,"54":520,"55":928,"56":520,"57":1944,"58":1,"59":3840,"60":3840,"61":3840,"62":1944,"63":1944,"64":3840,"65":2230,"66":2230,"67":2040,"68":103,"69":103,"70":103,"71":1937,"72":115,"73":115,"74":1822,"75":1610,"76":1610,"77":1606,"78":1606,"79":320,"80":1610,"81":1582,"82":1582,"83":515,"84":3840,"85":1,"86":133,"87":133,"88":1,"89":720333,"90":720333,"91":1,"92":68,"93":68,"94":1,"95":66,"96":1,"97":2,"98":2,"99":1,"100":9,"101":1,"102":14,"103":1,"104":1,"105":167,"106":1,"107":360001,"108":1,"109":1015,"110":121015,"111":1,"112":27,"113":27,"114":1,"115":67,"116":1,"117":1},"b":{"1":[27,25],"2":[27,25],"3":[27,25],"4":[27,25],"5":[26,1],"6":[720333,3600814],"7":[720001,332],"8":[429,3600385],"9":[66,156],"10":[60,6],"11":[66,64,54],"12":[2,154],"13":[520,1828],"14":[1944,1896],"15":[2230,1610],"16":[2040,190],"17":[103,1937],"18":[115,1822],"19":[1606,4],"20":[1610,1608],"21":[320,1286],"22":[1582,28],"23":[515,1067],"24":[133,103]},"f":{"1":27,"2":165,"3":360000,"4":1013,"5":27,"6":4321147,"7":222,"8":1944,"9":3840,"10":133,"11":720333,"12":68,"13":66,"14":2,"15":9,"16":14,"17":167,"18":360001,"19":1015,"20":121015,"21":27,"22":67},"fnMap":{"1":{"name":"Qlobber","line":115,"loc":{"start":{"line":115,"column":0},"end":{"line":116,"column":0}}},"2":{"name":"(anonymous_2)","line":125,"loc":{"start":{"line":125,"column":35},"end":{"line":126,"column":0}}},"3":{"name":"(anonymous_3)","line":130,"loc":{"start":{"line":130,"column":31},"end":{"line":131,"column":0}}},"4":{"name":"(anonymous_4)","line":135,"loc":{"start":{"line":135,"column":32},"end":{"line":136,"column":0}}},"5":{"name":"(anonymous_5)","line":145,"loc":{"start":{"line":145,"column":34},"end":{"line":146,"column":0}}},"6":{"name":"(anonymous_6)","line":157,"loc":{"start":{"line":157,"column":25},"end":{"line":158,"column":0}}},"7":{"name":"(anonymous_7)","line":188,"loc":{"start":{"line":188,"column":28},"end":{"line":189,"column":0}}},"8":{"name":"(anonymous_8)","line":226,"loc":{"start":{"line":226,"column":26},"end":{"line":227,"column":0}}},"9":{"name":"(anonymous_9)","line":246,"loc":{"start":{"line":246,"column":27},"end":{"line":247,"column":0}}},"10":{"name":"(anonymous_10)","line":311,"loc":{"start":{"line":311,"column":28},"end":{"line":312,"column":0}}},"11":{"name":"(anonymous_11)","line":330,"loc":{"start":{"line":330,"column":24},"end":{"line":331,"column":0}}},"12":{"name":"(anonymous_12)","line":343,"loc":{"start":{"line":343,"column":27},"end":{"line":344,"column":0}}},"13":{"name":"(anonymous_13)","line":355,"loc":{"start":{"line":355,"column":26},"end":{"line":356,"column":0}}},"14":{"name":"(anonymous_14)","line":367,"loc":{"start":{"line":367,"column":26},"end":{"line":368,"column":0}}},"15":{"name":"(anonymous_15)","line":374,"loc":{"start":{"line":374,"column":29},"end":{"line":375,"column":0}}},"16":{"name":"QlobberDedup","line":387,"loc":{"start":{"line":387,"column":0},"end":{"line":388,"column":0}}},"17":{"name":"(anonymous_17)","line":394,"loc":{"start":{"line":394,"column":40},"end":{"line":395,"column":0}}},"18":{"name":"(anonymous_18)","line":399,"loc":{"start":{"line":399,"column":36},"end":{"line":400,"column":0}}},"19":{"name":"(anonymous_19)","line":404,"loc":{"start":{"line":404,"column":37},"end":{"line":405,"column":0}}},"20":{"name":"(anonymous_20)","line":406,"loc":{"start":{"line":406,"column":19},"end":{"line":407,"column":4}}},"21":{"name":"(anonymous_21)","line":412,"loc":{"start":{"line":412,"column":39},"end":{"line":413,"column":0}}},"22":{"name":"(anonymous_22)","line":424,"loc":{"start":{"line":424,"column":31},"end":{"line":425,"column":0}}}},"statementMap":{"1":{"start":{"line":101,"column":0},"end":{"line":101,"column":27}},"2":{"start":{"line":115,"column":0},"end":{"line":123,"column":1}},"3":{"start":{"line":117,"column":4},"end":{"line":117,"column":28}},"4":{"start":{"line":119,"column":4},"end":{"line":119,"column":47}},"5":{"start":{"line":120,"column":4},"end":{"line":120,"column":53}},"6":{"start":{"line":121,"column":4},"end":{"line":121,"column":55}},"7":{"start":{"line":122,"column":4},"end":{"line":122,"column":20}},"8":{"start":{"line":125,"column":0},"end":{"line":128,"column":2}},"9":{"start":{"line":127,"column":4},"end":{"line":127,"column":17}},"10":{"start":{"line":130,"column":0},"end":{"line":133,"column":2}},"11":{"start":{"line":132,"column":4},"end":{"line":132,"column":28}},"12":{"start":{"line":135,"column":0},"end":{"line":143,"column":2}},"13":{"start":{"line":137,"column":4},"end":{"line":137,"column":66}},"14":{"start":{"line":139,"column":4},"end":{"line":142,"column":5}},"15":{"start":{"line":141,"column":8},"end":{"line":141,"column":41}},"16":{"start":{"line":145,"column":0},"end":{"line":155,"column":2}},"17":{"start":{"line":147,"column":4},"end":{"line":147,"column":38}},"18":{"start":{"line":149,"column":4},"end":{"line":152,"column":5}},"19":{"start":{"line":151,"column":8},"end":{"line":151,"column":30}},"20":{"start":{"line":154,"column":4},"end":{"line":154,"column":29}},"21":{"start":{"line":157,"column":0},"end":{"line":186,"column":2}},"22":{"start":{"line":159,"column":4},"end":{"line":159,"column":17}},"23":{"start":{"line":161,"column":4},"end":{"line":175,"column":5}},"24":{"start":{"line":163,"column":8},"end":{"line":163,"column":39}},"25":{"start":{"line":165,"column":8},"end":{"line":172,"column":9}},"26":{"start":{"line":167,"column":12},"end":{"line":167,"column":37}},"27":{"start":{"line":171,"column":12},"end":{"line":171,"column":65}},"28":{"start":{"line":174,"column":8},"end":{"line":174,"column":15}},"29":{"start":{"line":177,"column":4},"end":{"line":177,"column":20}},"30":{"start":{"line":178,"column":4},"end":{"line":178,"column":24}},"31":{"start":{"line":180,"column":4},"end":{"line":183,"column":5}},"32":{"start":{"line":182,"column":8},"end":{"line":182,"column":33}},"33":{"start":{"line":185,"column":4},"end":{"line":185,"column":37}},"34":{"start":{"line":188,"column":0},"end":{"line":224,"column":2}},"35":{"start":{"line":190,"column":4},"end":{"line":190,"column":17}},"36":{"start":{"line":192,"column":4},"end":{"line":204,"column":5}},"37":{"start":{"line":194,"column":8},"end":{"line":194,"column":39}},"38":{"start":{"line":196,"column":8},"end":{"line":201,"column":9}},"39":{"start":{"line":200,"column":12},"end":{"line":200,"column":45}},"40":{"start":{"line":203,"column":8},"end":{"line":203,"column":15}},"41":{"start":{"line":206,"column":4},"end":{"line":206,"column":20}},"42":{"start":{"line":207,"column":4},"end":{"line":207,"column":24}},"43":{"start":{"line":209,"column":4},"end":{"line":212,"column":5}},"44":{"start":{"line":211,"column":8},"end":{"line":211,"column":15}},"45":{"start":{"line":214,"column":4},"end":{"line":214,"column":40}},"46":{"start":{"line":217,"column":4},"end":{"line":220,"column":5}},"47":{"start":{"line":219,"column":8},"end":{"line":219,"column":15}},"48":{"start":{"line":223,"column":4},"end":{"line":223,"column":26}},"49":{"start":{"line":226,"column":0},"end":{"line":244,"column":2}},"50":{"start":{"line":228,"column":4},"end":{"line":228,"column":37}},"51":{"start":{"line":230,"column":4},"end":{"line":241,"column":5}},"52":{"start":{"line":232,"column":8},"end":{"line":232,"column":20}},"53":{"start":{"line":233,"column":8},"end":{"line":240,"column":9}},"54":{"start":{"line":235,"column":12},"end":{"line":238,"column":13}},"55":{"start":{"line":237,"column":16},"end":{"line":237,"column":49}},"56":{"start":{"line":239,"column":12},"end":{"line":239,"column":18}},"57":{"start":{"line":243,"column":4},"end":{"line":243,"column":13}},"58":{"start":{"line":246,"column":0},"end":{"line":309,"column":2}},"59":{"start":{"line":248,"column":4},"end":{"line":248,"column":17}},"60":{"start":{"line":250,"column":4},"end":{"line":250,"column":39}},"61":{"start":{"line":252,"column":4},"end":{"line":258,"column":5}},"62":{"start":{"line":255,"column":8},"end":{"line":255,"column":40}},"63":{"start":{"line":257,"column":8},"end":{"line":257,"column":52}},"64":{"start":{"line":260,"column":4},"end":{"line":306,"column":5}},"65":{"start":{"line":262,"column":8},"end":{"line":262,"column":39}},"66":{"start":{"line":264,"column":8},"end":{"line":281,"column":9}},"67":{"start":{"line":266,"column":12},"end":{"line":280,"column":13}},"68":{"start":{"line":268,"column":16},"end":{"line":268,"column":51}},"69":{"start":{"line":269,"column":16},"end":{"line":269,"column":45}},"70":{"start":{"line":270,"column":16},"end":{"line":270,"column":27}},"71":{"start":{"line":272,"column":17},"end":{"line":280,"column":13}},"72":{"start":{"line":274,"column":16},"end":{"line":274,"column":34}},"73":{"start":{"line":275,"column":16},"end":{"line":275,"column":30}},"74":{"start":{"line":279,"column":16},"end":{"line":279,"column":40}},"75":{"start":{"line":285,"column":8},"end":{"line":285,"column":24}},"76":{"start":{"line":287,"column":8},"end":{"line":295,"column":9}},"77":{"start":{"line":289,"column":12},"end":{"line":289,"column":32}},"78":{"start":{"line":291,"column":12},"end":{"line":294,"column":13}},"79":{"start":{"line":293,"column":16},"end":{"line":293,"column":53}},"80":{"start":{"line":297,"column":8},"end":{"line":305,"column":9}},"81":{"start":{"line":299,"column":12},"end":{"line":299,"column":46}},"82":{"start":{"line":301,"column":12},"end":{"line":304,"column":13}},"83":{"start":{"line":303,"column":16},"end":{"line":303,"column":53}},"84":{"start":{"line":308,"column":4},"end":{"line":308,"column":13}},"85":{"start":{"line":311,"column":0},"end":{"line":319,"column":2}},"86":{"start":{"line":313,"column":4},"end":{"line":316,"column":52}},"87":{"start":{"line":318,"column":4},"end":{"line":318,"column":31}},"88":{"start":{"line":330,"column":0},"end":{"line":334,"column":2}},"89":{"start":{"line":332,"column":4},"end":{"line":332,"column":64}},"90":{"start":{"line":333,"column":4},"end":{"line":333,"column":16}},"91":{"start":{"line":343,"column":0},"end":{"line":347,"column":2}},"92":{"start":{"line":345,"column":4},"end":{"line":345,"column":67}},"93":{"start":{"line":346,"column":4},"end":{"line":346,"column":16}},"94":{"start":{"line":355,"column":0},"end":{"line":358,"column":2}},"95":{"start":{"line":357,"column":4},"end":{"line":357,"column":35}},"96":{"start":{"line":367,"column":0},"end":{"line":371,"column":2}},"97":{"start":{"line":369,"column":4},"end":{"line":369,"column":20}},"98":{"start":{"line":370,"column":4},"end":{"line":370,"column":16}},"99":{"start":{"line":374,"column":0},"end":{"line":377,"column":2}},"100":{"start":{"line":376,"column":4},"end":{"line":376,"column":22}},"101":{"start":{"line":387,"column":0},"end":{"line":390,"column":1}},"102":{"start":{"line":389,"column":4},"end":{"line":389,"column":32}},"103":{"start":{"line":392,"column":0},"end":{"line":392,"column":37}},"104":{"start":{"line":394,"column":0},"end":{"line":397,"column":2}},"105":{"start":{"line":396,"column":4},"end":{"line":396,"column":30}},"106":{"start":{"line":399,"column":0},"end":{"line":402,"column":2}},"107":{"start":{"line":401,"column":4},"end":{"line":401,"column":18}},"108":{"start":{"line":404,"column":0},"end":{"line":410,"column":2}},"109":{"start":{"line":406,"column":4},"end":{"line":409,"column":7}},"110":{"start":{"line":408,"column":8},"end":{"line":408,"column":22}},"111":{"start":{"line":412,"column":0},"end":{"line":416,"column":2}},"112":{"start":{"line":414,"column":4},"end":{"line":414,"column":21}},"113":{"start":{"line":415,"column":4},"end":{"line":415,"column":27}},"114":{"start":{"line":424,"column":0},"end":{"line":427,"column":2}},"115":{"start":{"line":426,"column":4},"end":{"line":426,"column":42}},"116":{"start":{"line":429,"column":0},"end":{"line":429,"column":26}},"117":{"start":{"line":430,"column":0},"end":{"line":430,"column":36}}},"branchMap":{"1":{"line":117,"type":"binary-expr","locations":[{"start":{"line":117,"column":14},"end":{"line":117,"column":21}},{"start":{"line":117,"column":25},"end":{"line":117,"column":27}}]},"2":{"line":119,"type":"binary-expr","locations":[{"start":{"line":119,"column":22},"end":{"line":119,"column":39}},{"start":{"line":119,"column":43},"end":{"line":119,"column":46}}]},"3":{"line":120,"type":"binary-expr","locations":[{"start":{"line":120,"column":25},"end":{"line":120,"column":45}},{"start":{"line":120,"column":49},"end":{"line":120,"column":52}}]},"4":{"line":121,"type":"binary-expr","locations":[{"start":{"line":121,"column":26},"end":{"line":121,"column":47}},{"start":{"line":121,"column":51},"end":{"line":121,"column":54}}]},"5":{"line":149,"type":"if","locations":[{"start":{"line":149,"column":4},"end":{"line":149,"column":4}},{"start":{"line":149,"column":4},"end":{"line":149,"column":4}}]},"6":{"line":161,"type":"if","locations":[{"start":{"line":161,"column":4},"end":{"line":161,"column":4}},{"start":{"line":161,"column":4},"end":{"line":161,"column":4}}]},"7":{"line":165,"type":"if","locations":[{"start":{"line":165,"column":8},"end":{"line":165,"column":8}},{"start":{"line":165,"column":8},"end":{"line":165,"column":8}}]},"8":{"line":180,"type":"if","locations":[{"start":{"line":180,"column":4},"end":{"line":180,"column":4}},{"start":{"line":180,"column":4},"end":{"line":180,"column":4}}]},"9":{"line":192,"type":"if","locations":[{"start":{"line":192,"column":4},"end":{"line":192,"column":4}},{"start":{"line":192,"column":4},"end":{"line":192,"column":4}}]},"10":{"line":196,"type":"if","locations":[{"start":{"line":196,"column":8},"end":{"line":196,"column":8}},{"start":{"line":196,"column":8},"end":{"line":196,"column":8}}]},"11":{"line":196,"type":"binary-expr","locations":[{"start":{"line":196,"column":12},"end":{"line":196,"column":14}},{"start":{"line":197,"column":14},"end":{"line":197,"column":31}},{"start":{"line":198,"column":13},"end":{"line":198,"column":40}}]},"12":{"line":209,"type":"if","locations":[{"start":{"line":209,"column":4},"end":{"line":209,"column":4}},{"start":{"line":209,"column":4},"end":{"line":209,"column":4}}]},"13":{"line":233,"type":"if","locations":[{"start":{"line":233,"column":8},"end":{"line":233,"column":8}},{"start":{"line":233,"column":8},"end":{"line":233,"column":8}}]},"14":{"line":252,"type":"if","locations":[{"start":{"line":252,"column":4},"end":{"line":252,"column":4}},{"start":{"line":252,"column":4},"end":{"line":252,"column":4}}]},"15":{"line":260,"type":"if","locations":[{"start":{"line":260,"column":4},"end":{"line":260,"column":4}},{"start":{"line":260,"column":4},"end":{"line":260,"column":4}}]},"16":{"line":264,"type":"if","locations":[{"start":{"line":264,"column":8},"end":{"line":264,"column":8}},{"start":{"line":264,"column":8},"end":{"line":264,"column":8}}]},"17":{"line":266,"type":"if","locations":[{"start":{"line":266,"column":12},"end":{"line":266,"column":12}},{"start":{"line":266,"column":12},"end":{"line":266,"column":12}}]},"18":{"line":272,"type":"if","locations":[{"start":{"line":272,"column":17},"end":{"line":272,"column":17}},{"start":{"line":272,"column":17},"end":{"line":272,"column":17}}]},"19":{"line":287,"type":"if","locations":[{"start":{"line":287,"column":8},"end":{"line":287,"column":8}},{"start":{"line":287,"column":8},"end":{"line":287,"column":8}}]},"20":{"line":287,"type":"binary-expr","locations":[{"start":{"line":287,"column":13},"end":{"line":287,"column":40}},{"start":{"line":287,"column":46},"end":{"line":287,"column":74}}]},"21":{"line":291,"type":"if","locations":[{"start":{"line":291,"column":12},"end":{"line":291,"column":12}},{"start":{"line":291,"column":12},"end":{"line":291,"column":12}}]},"22":{"line":297,"type":"if","locations":[{"start":{"line":297,"column":8},"end":{"line":297,"column":8}},{"start":{"line":297,"column":8},"end":{"line":297,"column":8}}]},"23":{"line":301,"type":"if","locations":[{"start":{"line":301,"column":12},"end":{"line":301,"column":12}},{"start":{"line":301,"column":12},"end":{"line":301,"column":12}}]},"24":{"line":318,"type":"binary-expr","locations":[{"start":{"line":318,"column":11},"end":{"line":318,"column":22}},{"start":{"line":318,"column":26},"end":{"line":318,"column":30}}]}}}} |
@@ -10,3 +10,3 @@ var addSorting = (function () { | ||
// returns the summary table element | ||
function getTable() { return document.querySelector('.coverage-summary table'); } | ||
function getTable() { return document.querySelector('.coverage-summary'); } | ||
// returns the thead element of the summary table | ||
@@ -136,3 +136,5 @@ function getTableHeader() { return getTable().querySelector('thead tr'); } | ||
if (cols[i].sortable) { | ||
el = getNthColumn(i).querySelector('.sorter'); | ||
// add the click event handler on the th so users | ||
// dont have to click on those tiny arrows | ||
el = getNthColumn(i).querySelector('.sorter').parentElement; | ||
if (el.addEventListener) { | ||
@@ -139,0 +141,0 @@ el.addEventListener('click', ithSorter(i)); |
@@ -77,7 +77,15 @@ /*jslint node: true */ | ||
bench: { | ||
cmd: './node_modules/.bin/bench -c 10000 -i bench/options/default.js -k options' | ||
cmd: './node_modules/.bin/bench -c 20000 -i bench/options/default.js,bench/options/dedup.js -k options bench/add_match_remove bench/match' | ||
}, | ||
'bench-check': { | ||
cmd: './node_modules/.bin/bench -c 10000 -i bench/options/check.js -k options' | ||
cmd: './node_modules/.bin/bench -c 20000 -i bench/options/check.js,bench/options/check-dedup.js -k options bench/add_match_remove bench/match' | ||
}, | ||
'bench-add-many': { | ||
cmd: './node_modules/.bin/bench -c 1 -i bench/options/default.js,bench/options/dedup.js -k options bench/add_many.js' | ||
}, | ||
'bench-match-many': { | ||
cmd: './node_modules/.bin/bench -c 1 -i bench/options/default.js,bench/options/dedup.js -k options bench/match_many.js' | ||
} | ||
@@ -97,5 +105,9 @@ } | ||
grunt.registerTask('coveralls', 'exec:coveralls'); | ||
grunt.registerTask('bench', 'exec:bench'); | ||
grunt.registerTask('bench', ['exec:bench', | ||
'exec:bench-add-many', | ||
'exec:bench-match-many']); | ||
grunt.registerTask('bench-check', 'exec:bench-check'); | ||
grunt.registerTask('bench-add-many', 'exec:bench-add-many'); | ||
grunt.registerTask('bench-match-many', 'exec:bench-match-many'); | ||
grunt.registerTask('default', ['jslint', 'cafemocha']); | ||
}; |
@@ -101,2 +101,4 @@ /** | ||
var util = require('util'); | ||
/** | ||
@@ -124,2 +126,34 @@ Creates a new qlobber. | ||
Qlobber.prototype._initial_value = function (val) | ||
{ | ||
return [val]; | ||
}; | ||
Qlobber.prototype._add_value = function (vals, val) | ||
{ | ||
vals[vals.length] = val; | ||
}; | ||
Qlobber.prototype._add_values = function (dest, origin) | ||
{ | ||
var i, destLength = dest.length, originLength = origin.length; | ||
for (i = 0; i < originLength; i += 1) | ||
{ | ||
dest[destLength + i] = origin[i]; | ||
} | ||
}; | ||
Qlobber.prototype._remove_value = function (vals, val) | ||
{ | ||
var index = vals.lastIndexOf(val); | ||
if (index >= 0) | ||
{ | ||
vals.splice(index, 1); | ||
} | ||
return vals.length === 0; | ||
}; | ||
Qlobber.prototype._add = function (val, i, words, sub_trie) | ||
@@ -135,7 +169,7 @@ { | ||
{ | ||
st[st.length] = val; | ||
this._add_value(st, val); | ||
} | ||
else | ||
{ | ||
sub_trie[this._separator] = [val]; | ||
sub_trie[this._separator] = this._initial_value(val); | ||
} | ||
@@ -159,3 +193,3 @@ | ||
{ | ||
var st, index, word; | ||
var st, word; | ||
@@ -166,22 +200,7 @@ if (i === words.length) | ||
if (st) | ||
if (st && | ||
((val === undefined) || | ||
this._remove_value(st, val))) | ||
{ | ||
if (val === undefined) | ||
{ | ||
st = []; | ||
} | ||
else | ||
{ | ||
index = st.lastIndexOf(val); | ||
if (index >= 0) | ||
{ | ||
st.splice(index, 1); | ||
} | ||
} | ||
if (st.length === 0) | ||
{ | ||
delete sub_trie[this._separator]; | ||
} | ||
delete sub_trie[this._separator]; | ||
} | ||
@@ -212,32 +231,22 @@ | ||
function forInRep(self, v, i, words, st) { | ||
Qlobber.prototype._some = function (v, i, words, st) | ||
{ | ||
var keys = Object.keys(st), j, w; | ||
var keys = Object.keys(st), j = 0, w = null; | ||
for (j = 0; j < keys.length; j += 1) | ||
{ | ||
w = keys[j]; | ||
if (w !== self._separator) | ||
for (j = 0; j < keys.length; j += 1) | ||
{ | ||
for (j = i; j < words.length; j += 1) | ||
w = keys[j]; | ||
if (w !== this._separator) | ||
{ | ||
v = self._match(v, j, words, st); | ||
for (j = i; j < words.length; j += 1) | ||
{ | ||
v = this._match(v, j, words, st); | ||
} | ||
break; | ||
} | ||
break; | ||
} | ||
} | ||
return v; | ||
} | ||
return v; | ||
}; | ||
function addAll(dest, origin) { | ||
var i, destLength = dest.length, originLength = origin.length; | ||
for (i = 0; i < originLength; i += 1) { | ||
dest[destLength + i] = origin[i]; | ||
} | ||
return dest; | ||
} | ||
Qlobber.prototype._match = function (v, i, words, sub_trie) | ||
@@ -251,6 +260,5 @@ { | ||
{ | ||
// common case: no more levels | ||
v = forInRep(this, v, i, words, st); | ||
// in the common case there will be no more levels... | ||
v = this._some(v, i, words, st); | ||
// and we'll end up matching the rest of the words: | ||
v = this._match(v, words.length, words, st); | ||
@@ -265,3 +273,17 @@ } | ||
{ | ||
v = addAll(v, st); | ||
if (v.dest) | ||
{ | ||
this._add_values(v.dest, v.source); | ||
this._add_values(v.dest, st); | ||
v = v.dest; | ||
} | ||
else if (v.source) | ||
{ | ||
v.dest = v.source; | ||
v.source = st; | ||
} | ||
else | ||
{ | ||
this._add_values(v, st); | ||
} | ||
} | ||
@@ -297,2 +319,12 @@ } | ||
Qlobber.prototype._match2 = function (v, topic) | ||
{ | ||
var vals = this._match( | ||
{ | ||
source: v | ||
}, 0, topic.split(this._separator), this._trie); | ||
return vals.source || vals; | ||
}; | ||
/** | ||
@@ -334,3 +366,3 @@ Add a topic matcher to the qlobber. | ||
{ | ||
return this._match([], 0, topic.split(this._separator), this._trie); | ||
return this._match2([], topic); | ||
}; | ||
@@ -357,3 +389,54 @@ | ||
/** | ||
Creates a new de-duplicating qlobber. | ||
Inherits from Qlobber. | ||
@constructor | ||
@param {Object} [options] Same options as Qlobber. | ||
*/ | ||
function QlobberDedup (options) | ||
{ | ||
Qlobber.call(this, options); | ||
} | ||
util.inherits(QlobberDedup, Qlobber); | ||
QlobberDedup.prototype._initial_value = function (val) | ||
{ | ||
return new Set().add(val); | ||
}; | ||
QlobberDedup.prototype._add_value = function (vals, val) | ||
{ | ||
vals.add(val); | ||
}; | ||
QlobberDedup.prototype._add_values = function (dest, origin) | ||
{ | ||
origin.forEach(function (val) | ||
{ | ||
dest.add(val); | ||
}); | ||
}; | ||
QlobberDedup.prototype._remove_value = function (vals, val) | ||
{ | ||
vals.delete(val); | ||
return vals.size === 0; | ||
}; | ||
/** | ||
Match a topic. | ||
@param {String} topic The topic to match against. | ||
@return {Set} [ES6 Set](http://www.ecma-international.org/ecma-262/6.0/#sec-set-objects) of values that matched the topic. | ||
*/ | ||
QlobberDedup.prototype.match = function (topic) | ||
{ | ||
return this._match2(new Set(), topic); | ||
}; | ||
exports.Qlobber = Qlobber; | ||
exports.QlobberDedup = QlobberDedup; | ||
{ | ||
"name": "qlobber", | ||
"description": "Node.js globbing for amqp-like topics", | ||
"version": "0.5.3", | ||
"version": "0.6.0", | ||
"homepage": "https://github.com/davedoesdev/qlobber", | ||
@@ -35,2 +35,5 @@ "author": { | ||
], | ||
"engines": { | ||
"node": ">= 0.12" | ||
}, | ||
"devDependencies": { | ||
@@ -41,9 +44,9 @@ "grunt": "~0.4.5", | ||
"grunt-cafe-mocha": "~0.1.13", | ||
"grunt-apidox": "~0.1.6", | ||
"chai": "~2.3.0", | ||
"istanbul": "~0.3.14", | ||
"grunt-apidox": "~0.1.8", | ||
"chai": "~3.5.0", | ||
"istanbul": "~0.4.2", | ||
"grunt-exec": "~0.4.6", | ||
"coveralls": "~2.11.2", | ||
"coveralls": "~2.11.8", | ||
"b": "git://github.com/davedoesdev/b.git" | ||
} | ||
} |
@@ -105,2 +105,4 @@ # qlobber [![Build Status](https://travis-ci.org/davedoesdev/qlobber.png)](https://travis-ci.org/davedoesdev/qlobber) [![Coverage Status](https://coveralls.io/repos/davedoesdev/qlobber/badge.png?branch=master)](https://coveralls.io/r/davedoesdev/qlobber?branch=master) [![NPM version](https://badge.fury.io/js/qlobber.png)](http://badge.fury.io/js/qlobber) | ||
- <a name="toc_qlobberprototypeclear"></a>[Qlobber.prototype.clear](#qlobberprototypeclear) | ||
- <a name="toc_qlobberdedupoptions"></a>[QlobberDedup](#qlobberdedupoptions) | ||
- <a name="toc_qlobberdedupprototypematchtopic"></a><a name="toc_qlobberdedupprototype"></a>[QlobberDedup.prototype.match](#qlobberdedupprototypematchtopic) | ||
@@ -182,2 +184,30 @@ ## Qlobber([options]) | ||
## QlobberDedup([options]) | ||
> Creates a new de-duplicating qlobber. | ||
Inherits from [Qlobber](#qlobberoptions). | ||
**Parameters:** | ||
- `{Object} [options]` Same options as [Qlobber](#qlobberoptions). | ||
<sub>Go: [TOC](#tableofcontents)</sub> | ||
<a name="qlobberdedupprototype"></a> | ||
## QlobberDedup.prototype.match(topic) | ||
> Match a topic. | ||
**Parameters:** | ||
- `{String} topic` The topic to match against. | ||
**Return:** | ||
`{Set}` [ES6 Set](http://www.ecma-international.org/ecma-262/6.0/#sec-set-objects) of values that matched the topic. | ||
<sub>Go: [TOC](#tableofcontents) | [QlobberDedup.prototype](#toc_qlobberdedupprototype)</sub> | ||
_—generated by [apidox](https://github.com/codeactual/apidox)—_ |
@@ -213,3 +213,25 @@ /*globals rabbitmq_test_bindings : false, | ||
}); | ||
it('should match expected number of topics', function () | ||
{ | ||
// under coverage this takes longer | ||
this.timeout(60000); | ||
var i, j, vals; | ||
for (i = 0; i < 60000; i += 1) | ||
{ | ||
for (j = 0; j < 5; j += 1) | ||
{ | ||
matcher.add('app.test.user.behrad.testTopic-' + j, i); | ||
} | ||
matcher.add('app.test.user.behrad.*', i); | ||
} | ||
vals = matcher.match('app.test.user.behrad.testTopic-0'); | ||
expect(vals.length).to.equal(120000); | ||
expect(vals.remove_duplicates().length).to.equal(60000); | ||
}); | ||
}); | ||
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
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
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
Sorry, the diff of this file is not supported yet
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
163161
33
1550
212