mirror of
https://github.com/public-transport/db-vendo-client.git
synced 2025-06-19 10:42:33 +03:00
18 lines
338 B
JavaScript
18 lines
338 B
JavaScript
|
'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
|