git ssb

16+

Dominic / patchbay



Tree: a41e049ca3755ddfd97e7f53c9da830711e636f1

Files: a41e049ca3755ddfd97e7f53c9da830711e636f1 / app / sync / locationId.js

485 bytesRaw
1const nest = require('depnest')
2const get = require('lodash/get')
3const { isMsg } = require('ssb-ref')
4
5exports.gives = nest({ 'app.sync.locationId': true })
6
7exports.create = function (api) {
8 return nest('app.sync.locationId', locationId)
9
10 function locationId (location) {
11 if (typeof location === 'string') return string
12
13 if (isMsg(location.key)) location = {
14 key: get(location, 'value.content.root', location.key)
15 }
16
17 return JSON.stringify(location)
18 }
19}
20
21

Built with git-ssb-web