mirror of
https://github.com/amark/gun.git
synced 2025-03-30 15:08:33 +00:00
mix node
This commit is contained in:
parent
e5589d435c
commit
e1ae0158a4
17
lib/mix.js
Normal file
17
lib/mix.js
Normal file
@ -0,0 +1,17 @@
|
||||
;(function(){
|
||||
var Gun = (typeof window !== "undefined")? window.Gun : require('../gun');
|
||||
Gun.state.node = function(node, vertex, opt){
|
||||
opt = opt || {};
|
||||
opt.state = opt.state || Gun.state();
|
||||
var now = Gun.obj.copy(vertex);
|
||||
Gun.node.is(node, function(val, key){
|
||||
var ham = Gun.HAM(opt.state, Gun.state.is(node, key), Gun.state.is(vertex, key), val, vertex[key]);
|
||||
if(!ham.incoming){
|
||||
// if(ham.defer){}
|
||||
return;
|
||||
}
|
||||
now = Gun.state.to(node, key, now);
|
||||
});
|
||||
return now;
|
||||
}
|
||||
}());
|
Loading…
x
Reference in New Issue
Block a user