re-did .tagged(..)

Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
Alex A. Naanou 2018-12-02 01:48:41 +03:00
parent 67901ddc56
commit 2a74b95ff5

View File

@ -445,16 +445,17 @@ var TagsPrototype = {
// //
// XXX not sure if this is optimal... // XXX not sure if this is optimal...
tagged: function(value, ...tags){ tagged: function(value, ...tags){
var that = this
tags = tags.length == 1 && tags[0] instanceof Array ? tags = tags.length == 1 && tags[0] instanceof Array ?
tags.shift() tags.shift()
: tags : tags
return tags var u = this.tags(value)
.reduce(function(res, tag){ while(tags.length > 0){
return res === false ? if(this.match(tags.shift(), u).length == 0){
res return false
// XXX do not like the back and forth set conversion here... }
: new Set(that.values(tag)).has(value) }, true) }, }
return true
},
// Add/Remove/Modify tags API... // Add/Remove/Modify tags API...