mirror of
https://github.com/amark/gun.git
synced 2025-03-30 15:08:33 +00:00
Update sea.js
This commit is contained in:
parent
d8dd8f11f0
commit
20284e18c7
13
sea.js
13
sea.js
@ -669,23 +669,30 @@
|
||||
}
|
||||
// then figuring out all possible candidates having matching username
|
||||
const aliases = []
|
||||
let c = 0
|
||||
// TODO: how about having real chainable map without callback ?
|
||||
Gun.obj.map(rat.put, (at, pub) => {
|
||||
if (!pub.slice || 'pub/' !== pub.slice(0, 4)) {
|
||||
// TODO: ... this would then be .filter((at, pub))
|
||||
return
|
||||
}
|
||||
++c
|
||||
// grab the account associated with this public key.
|
||||
gunRoot.get(pub).get((at, ev) => {
|
||||
root.get(pub).get((at, ev) => {
|
||||
pub = pub.slice(4)
|
||||
ev.off()
|
||||
--c
|
||||
if (at.put){
|
||||
aliases.push({ pub, at })
|
||||
}
|
||||
if (!c && (c = -1)) {
|
||||
resolve(aliases)
|
||||
}
|
||||
})
|
||||
})
|
||||
return !aliases.length ? reject({ err: 'Public key does not exist!' })
|
||||
: resolve(aliases)
|
||||
if (!c) {
|
||||
reject({ err: 'Public key does not exist!' })
|
||||
}
|
||||
})
|
||||
})
|
||||
module.exports = queryGunAliases
|
||||
|
Loading…
x
Reference in New Issue
Block a user