return name and reference separately

This commit is contained in:
karenzshea
2016-09-05 09:01:51 -04:00
committed by Moritz Kobitzsch
parent 938dff011f
commit dcc1b5ab2b
29 changed files with 131 additions and 74 deletions
+4
View File
@@ -139,6 +139,10 @@ module.exports = function () {
return this.extractInstructionList(instructions, s => s.name);
};
this.refList = (instructions) => {
return this.extractInstructionList(instructions, s => s.ref || '');
};
this.pronunciationList = (instructions) => {
return this.extractInstructionList(instructions, s => s.pronunciation || '');
};
+3 -1
View File
@@ -34,7 +34,7 @@ module.exports = function () {
var afterRequest = (err, res, body) => {
if (err) return cb(err);
if (body && body.length) {
let destinations, pronunciations, instructions, bearings, turns, modes, times,
let destinations, pronunciations, instructions, refs, bearings, turns, modes, times,
distances, summary, intersections, lanes;
let json = JSON.parse(body);
@@ -44,6 +44,7 @@ module.exports = function () {
if (hasRoute) {
instructions = this.wayList(json.routes[0]);
pronunciations = this.pronunciationList(json.routes[0]);
refs = this.refList(json.routes[0]);
destinations = this.destinationsList(json.routes[0]);
bearings = this.bearingList(json.routes[0]);
turns = this.turnList(json.routes[0]);
@@ -128,6 +129,7 @@ module.exports = function () {
if (headers.has(key)) got[key] = instructions ? value : '';
};
putValue('ref', refs);
putValue('bearing', bearings);
putValue('turns', turns);
putValue('modes', modes);