Files: dc2e96d4d0a86072d9393a2d15d786a80cb341ff / app / sync / locationId.js
501 bytesRaw
1 | const nest = require('depnest') |
2 | const get = require('lodash/get') |
3 | const { isMsg } = require('ssb-ref') |
4 | |
5 | exports.gives = nest({ 'app.sync.locationId': true }) |
6 | |
7 | exports.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)) { |
14 | location = { |
15 | key: get(location, 'value.content.root', location.key) |
16 | } |
17 | } |
18 | |
19 | return JSON.stringify(location) |
20 | } |
21 | } |
22 |
Built with git-ssb-web