mirror of
https://github.com/amark/gun.git
synced 2025-03-30 15:08:33 +00:00
fix Lex lookups
This commit is contained in:
parent
b78e73a32b
commit
a111e20f27
18
gun.js
18
gun.js
@ -49,10 +49,10 @@
|
||||
if(t.slice(0, (tmp||'').length) === tmp){ return true }
|
||||
if(u !== o['*']){ return false }
|
||||
if(u !== o['>'] && u !== o['<']){
|
||||
return (t > o['>'] && t < o['<'])? true : false;
|
||||
return (t >= o['>'] && t <= o['<'])? true : false;
|
||||
}
|
||||
if(u !== o['>'] && t > o['>']){ return true }
|
||||
if(u !== o['<'] && t < o['<']){ return true }
|
||||
if(u !== o['>'] && t >= o['>']){ return true }
|
||||
if(u !== o['<'] && t <= o['<']){ return true }
|
||||
return false;
|
||||
}
|
||||
Type.list = {is: function(l){ return (l instanceof Array) }}
|
||||
@ -958,7 +958,7 @@
|
||||
if(tmp){ return }
|
||||
msg.$ = back.$;
|
||||
} else
|
||||
if(obj_has(back.put, get)){
|
||||
if(obj_has(back.put, get)){ // TODO: support #LEX !
|
||||
put = (back.$.get(get)._);
|
||||
if(!(tmp = put.ack)){ put.ack = -1 }
|
||||
back.on('in', {
|
||||
@ -1178,14 +1178,16 @@
|
||||
});
|
||||
}
|
||||
function ask(at, soul){
|
||||
var tmp = (at.root.$.get(soul)._);
|
||||
if(at.ack){
|
||||
tmp.on('out', {get: {'#': soul}});
|
||||
var tmp = (at.root.$.get(soul)._), lex = at.lex;
|
||||
if(at.ack || lex){
|
||||
(lex = lex||{})['#'] = soul;
|
||||
tmp.on('out', {get: lex});
|
||||
if(!at.ask){ return } // TODO: PERFORMANCE? More elegant way?
|
||||
}
|
||||
tmp = at.ask; Gun.obj.del(at, 'ask');
|
||||
obj_map(tmp || at.next, function(neat, key){
|
||||
neat.on('out', {get: {'#': soul, '.': key}});
|
||||
var lex = neat.lex || {}; lex['#'] = soul; lex['.'] = lex['.'] || key;
|
||||
neat.on('out', {get: lex});
|
||||
});
|
||||
Gun.obj.del(at, 'ask'); // TODO: PERFORMANCE? More elegant way?
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "gun",
|
||||
"version": "0.2019.427",
|
||||
"version": "0.2019.428",
|
||||
"description": "A realtime, decentralized, offline-first, graph data synchronization engine.",
|
||||
"main": "index.js",
|
||||
"browser": "gun.js",
|
||||
|
@ -49,7 +49,7 @@ function Mesh(ctx){
|
||||
}
|
||||
(msg._ = function(){}).via = peer;
|
||||
if((tmp = msg['><'])){
|
||||
(msg._).to = Type.obj.map(tmp.split(','), function(k,i,m){m(k,true)});
|
||||
(msg._).to = Type.obj.map(tmp.split(','), tomap);
|
||||
}
|
||||
if(msg.dam){
|
||||
if(tmp = mesh.hear[msg.dam]){
|
||||
@ -72,6 +72,7 @@ function Mesh(ctx){
|
||||
return;
|
||||
}
|
||||
}
|
||||
var tomap = function(k,i,m){m(k,true)};
|
||||
|
||||
;(function(){
|
||||
mesh.say = function(msg, peer, o){
|
||||
|
12
src/chain.js
12
src/chain.js
@ -37,7 +37,7 @@ function output(msg){
|
||||
if(tmp){ return }
|
||||
msg.$ = back.$;
|
||||
} else
|
||||
if(obj_has(back.put, get)){
|
||||
if(obj_has(back.put, get)){ // TODO: support #LEX !
|
||||
put = (back.$.get(get)._);
|
||||
if(!(tmp = put.ack)){ put.ack = -1 }
|
||||
back.on('in', {
|
||||
@ -257,14 +257,16 @@ function not(at, msg){
|
||||
});
|
||||
}
|
||||
function ask(at, soul){
|
||||
var tmp = (at.root.$.get(soul)._);
|
||||
if(at.ack){
|
||||
tmp.on('out', {get: {'#': soul}});
|
||||
var tmp = (at.root.$.get(soul)._), lex = at.lex;
|
||||
if(at.ack || lex){
|
||||
(lex = lex||{})['#'] = soul;
|
||||
tmp.on('out', {get: lex});
|
||||
if(!at.ask){ return } // TODO: PERFORMANCE? More elegant way?
|
||||
}
|
||||
tmp = at.ask; Gun.obj.del(at, 'ask');
|
||||
obj_map(tmp || at.next, function(neat, key){
|
||||
neat.on('out', {get: {'#': soul, '.': key}});
|
||||
var lex = neat.lex || {}; lex['#'] = soul; lex['.'] = lex['.'] || key;
|
||||
neat.on('out', {get: lex});
|
||||
});
|
||||
Gun.obj.del(at, 'ask'); // TODO: PERFORMANCE? More elegant way?
|
||||
}
|
||||
|
@ -29,10 +29,10 @@ Type.text.match = function(t, o){ var tmp, u;
|
||||
if(t.slice(0, (tmp||'').length) === tmp){ return true }
|
||||
if(u !== o['*']){ return false }
|
||||
if(u !== o['>'] && u !== o['<']){
|
||||
return (t > o['>'] && t < o['<'])? true : false;
|
||||
return (t >= o['>'] && t <= o['<'])? true : false;
|
||||
}
|
||||
if(u !== o['>'] && t > o['>']){ return true }
|
||||
if(u !== o['<'] && t < o['<']){ return true }
|
||||
if(u !== o['>'] && t >= o['>']){ return true }
|
||||
if(u !== o['<'] && t <= o['<']){ return true }
|
||||
return false;
|
||||
}
|
||||
Type.list = {is: function(l){ return (l instanceof Array) }}
|
||||
|
Loading…
x
Reference in New Issue
Block a user