mirror of
https://github.com/amark/gun.git
synced 2025-03-30 15:08:33 +00:00
Merge peer options
This commit is contained in:
parent
3882fe3da8
commit
146f821e56
6
gun.js
6
gun.js
@ -538,13 +538,15 @@
|
||||
var gun = this, root = (gun.__ && gun.__.gun)? gun.__.gun : (gun._ = gun.__ = {gun: gun}).gun.chain(); // if root does not exist, then create a root chain.
|
||||
root.__.by = root.__.by || function(f){ return gun.__.by[f] = gun.__.by[f] || {} };
|
||||
root.__.graph = root.__.graph || {};
|
||||
root.__.opt = root.__.opt || {};
|
||||
root.__.opt = root.__.opt || {peers: {}};
|
||||
root.__.opt.wire = root.__.opt.wire || {};
|
||||
if(Gun.text.is(opt)){ opt = {peers: opt} }
|
||||
if(Gun.list.is(opt)){ opt = {peers: opt} }
|
||||
if(Gun.text.is(opt.peers)){ opt.peers = [opt.peers] }
|
||||
if(Gun.list.is(opt.peers)){ opt.peers = Gun.obj.map(opt.peers, function(n,f,m){ m(n,{}) }) }
|
||||
root.__.opt.peers = opt.peers || gun.__.opt.peers || {};
|
||||
Gun.obj.map(opt.peers, function(v, f){
|
||||
root.__.opt.peers[f] = v;
|
||||
});
|
||||
Gun.obj.map(opt.wire, function(h, f){
|
||||
if(!Gun.fns.is(h)){ return }
|
||||
root.__.opt.wire[f] = h;
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "gun",
|
||||
"version": "0.3.94",
|
||||
"version": "0.3.95",
|
||||
"description": "Graph engine",
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
|
Loading…
x
Reference in New Issue
Block a user