Add .map to Chain

This commit is contained in:
Alex LaFroscia 2015-01-18 04:30:34 -05:00
parent 3cbd827b20
commit 96be393bdc

16
gun.js
View File

@ -459,6 +459,22 @@
this._.dud = Gun.fns.is(dud)? dud : function(){};
return this;
}
Chain.map = function(cb){
var gun = this;
gun.shot.then(function(val){
cb = cb || function(){};
//console.log("map module is loading", val);
Gun.obj.map(val, function(obj, soul){
//console.log(obj, Gun.is.soul(obj));
if(!Gun.is.soul(obj)){ return; }
gun.load(obj).get(function(obj){
delete obj._;
cb.call(this, obj, soul);
});
});
});
return gun;
}
}(Gun.chain = Gun.prototype));
;(function(Util){
Util.fns = {};