db-vendo-client/stringify/address.js

18 lines
338 B
JavaScript
Raw Normal View History

2017-11-12 00:45:51 +01:00
'use strict'
const stringifyCoord = require('./coord')
const stringifyAddress = (latitude, longitude, name) => {
if (!latitude || !longitude || !name) throw new Error('invalid address.')
return {
type: 'A',
name,
crd: {
x: stringifyCoord(longitude),
y: stringifyCoord(latitude)
}
}
}
module.exports = stringifyAddress