mirror of
https://github.com/public-transport/db-vendo-client.git
synced 2025-02-23 23:29:35 +02: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
|