|
|
|
@ -38,13 +38,13 @@ function sanitize( req ){
|
|
|
|
|
parsedAddress0.admin_parts = params.input.substring(delimIndex + 1).trim(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
var splitOnSpace = params.input.split(' '); |
|
|
|
|
var splitOnDelim = params.input.split(delim); |
|
|
|
|
var splitOnDelim = params.input.split(delim).join(''); |
|
|
|
|
var splitOnSpace = delim !== ' ' ? splitOnDelim.split(' ') : splitOnDelim; |
|
|
|
|
// set target_layer if input length <= 3 characters
|
|
|
|
|
if (params.input.length <= 3 ) { |
|
|
|
|
// no address parsing required
|
|
|
|
|
parsedAddress2.target_layer = get_layers(['admin']); |
|
|
|
|
} else if (splitOnDelim.length < 3 || splitOnSpace.length < 3) { |
|
|
|
|
} else if (splitOnSpace.length < 3) { |
|
|
|
|
// no need to hit address layers if there's only two tokens
|
|
|
|
|
parsedAddress2.target_layer = get_layers(['admin', 'poi']); |
|
|
|
|
} else { |
|
|
|
|