mirror of
https://github.com/public-transport/db-vendo-client.git
synced 2025-02-23 07:09:35 +02:00
19 lines
361 B
JavaScript
19 lines
361 B
JavaScript
'use strict'
|
|
|
|
const formatCoord = require('./coord')
|
|
|
|
const formatAddress = (a) => {
|
|
// todo: type-checking, better error msgs
|
|
if (!a.latitude || !a.longitude || !a.name) throw new Error('invalid address.')
|
|
|
|
return {
|
|
type: 'A',
|
|
name: a.name,
|
|
crd: {
|
|
x: formatCoord(a.longitude),
|
|
y: formatCoord(a.latitude)
|
|
}
|
|
}
|
|
}
|
|
|
|
module.exports = formatAddress
|