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