mirror of
https://github.com/public-transport/db-vendo-client.git
synced 2025-10-29 23:26:31 +02:00
18 lines
323 B
JavaScript
18 lines
323 B
JavaScript
|
|
'use strict'
|
||
|
|
|
||
|
|
const formatCoord = require('./coord')
|
||
|
|
|
||
|
|
const formatAddress = (latitude, longitude, name) => {
|
||
|
|
if (!latitude || !longitude || !name) throw new Error('invalid address.')
|
||
|
|
return {
|
||
|
|
type: 'A',
|
||
|
|
name,
|
||
|
|
crd: {
|
||
|
|
x: formatCoord(longitude),
|
||
|
|
y: formatCoord(latitude)
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
module.exports = formatAddress
|