mirror of
https://github.com/amark/gun.git
synced 2025-06-07 14:46:44 +00:00
fix null doc
This commit is contained in:
parent
68ba4dcc65
commit
959e8e36bb
10
lib/open.js
10
lib/open.js
@ -35,15 +35,19 @@ Gun.chain.open = function(cb, opt, at){
|
|||||||
}
|
}
|
||||||
var tmp = this, id;
|
var tmp = this, id;
|
||||||
Gun.obj.map(data, function(val, key){
|
Gun.obj.map(data, function(val, key){
|
||||||
|
var doc = at || opt.doc;
|
||||||
|
if (!doc) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
if(!(id = Gun.val.link.is(val))){
|
if(!(id = Gun.val.link.is(val))){
|
||||||
(at || opt.doc)[key] = val;
|
doc[key] = val;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if(opt.ids[id]){
|
if(opt.ids[id]){
|
||||||
(at || opt.doc)[key] = opt.ids[id];
|
doc[key] = opt.ids[id];
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
tmp.get(key).open(opt.any, opt, opt.ids[id] = (at || opt.doc)[key] = {});
|
tmp.get(key).open(opt.any, opt, opt.ids[id] = doc[key] = {});
|
||||||
});
|
});
|
||||||
})
|
})
|
||||||
}
|
}
|
Loading…
x
Reference in New Issue
Block a user