mirror of
				https://github.com/public-transport/db-vendo-client.git
				synced 2025-10-30 23:56:31 +02:00 
			
		
		
		
	more fixes for 3811b45 🐛
				
					
				
			This commit is contained in:
		
							parent
							
								
									0b37e62e09
								
							
						
					
					
						commit
						e6f7a09505
					
				
					 3 changed files with 6 additions and 6 deletions
				
			
		|  | @ -3,13 +3,13 @@ | ||||||
| const formatCoord = require('./coord') | const formatCoord = require('./coord') | ||||||
| 
 | 
 | ||||||
| const formatAddress = (a) => { | const formatAddress = (a) => { | ||||||
| 	if (!a.type !== 'location' || !a.latitude || !a.longitude || !a.address) { | 	if (a.type !== 'location' || !a.latitude || !a.longitude || !a.address) { | ||||||
| 		throw new Error('invalid address') | 		throw new Error('invalid address') | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
| 	return { | 	return { | ||||||
| 		type: 'A', | 		type: 'A', | ||||||
| 		name: a.name, | 		name: a.address, | ||||||
| 		crd: { | 		crd: { | ||||||
| 			x: formatCoord(a.longitude), | 			x: formatCoord(a.longitude), | ||||||
| 			y: formatCoord(a.latitude) | 			y: formatCoord(a.latitude) | ||||||
|  |  | ||||||
|  | @ -2,10 +2,10 @@ | ||||||
| 
 | 
 | ||||||
| const formatLocation = (profile, l) => { | const formatLocation = (profile, l) => { | ||||||
| 	if ('string' === typeof l) return profile.formatStation(l) | 	if ('string' === typeof l) return profile.formatStation(l) | ||||||
| 	if ('object' === typeof l) { | 	if ('object' === typeof l && !Array.isArray(l)) { | ||||||
| 		if (l.type === 'station') return profile.formatStation(l.id) | 		if (l.type === 'station') return profile.formatStation(l.id) | ||||||
| 		if (l.type === 'poi') return profile.formatPoi(l) | 		if ('string' === typeof l.id) return profile.formatPoi(l) | ||||||
| 		if (l.type === 'address') return profile.formatAddress(l) | 		if ('string' === typeof l.address) return profile.formatAddress(l) | ||||||
| 		throw new Error('invalid location type: ' + l.type) | 		throw new Error('invalid location type: ' + l.type) | ||||||
| 	} | 	} | ||||||
| 	throw new Error('valid station, address or poi required.') | 	throw new Error('valid station, address or poi required.') | ||||||
|  |  | ||||||
|  | @ -3,7 +3,7 @@ | ||||||
| const formatCoord = require('./coord') | const formatCoord = require('./coord') | ||||||
| 
 | 
 | ||||||
| const formatPoi = (p) => { | const formatPoi = (p) => { | ||||||
| 	if (!p.type !== 'location' || !p.latitude || !p.longitude || !p.id || !p.name) { | 	if (p.type !== 'location' || !p.latitude || !p.longitude || !p.id || !p.name) { | ||||||
| 		throw new Error('invalid POI') | 		throw new Error('invalid POI') | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		
		Reference in a new issue