You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
As for supporting the 'list' patrun as depicted in the README, it's not currently possible to remove elements in sparse order.
varpatrun=require('patrun'),many=patrun(function(pat,data){varitems=this.find(pat,true)||[]items.push(data)return{find: function(args,data){console.log('find',arguments)return0<items.length ? items : null},remove: function(args,data){// data is always 'A'items.pop()return0==items.length;}}})many.add({a:1},'A')many.add({a:1},'B')many.remove({a:1},'A')console.log(many.find({a:1}))// should be [ 'B' ], but is 'A'
I suggest that the custom remove should include a way for passing the dest value through the remove call.
As for supporting the 'list' patrun as depicted in the README, it's not currently possible to remove elements in sparse order.
I suggest that the custom remove should include a way for passing the dest value through the remove call.
Moreover, I think the following line https://github.com/rjrodger/patrun/blob/master/patrun.js#L92 should be changed: it's impossible to remove the original data through the custom remove function.
The text was updated successfully, but these errors were encountered: