Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 | 19x 5x 2x 5x 1x 1x 1x 1x 1x 1x 1x 19x 7x 7x 7x 7x 7x 202x 2x 2x 200x 2x 2x 198x 7x 12x 12x 12x 12x 6x 6x 6x 6x 6x 16x 16x 16x 6x 6x | import { Ionicons } from "@expo/vector-icons";
import { ManeuverTypeApi } from "../../type";
export function getManeuverIcon(
maneuver: ManeuverTypeApi,
): keyof typeof Ionicons.glyphMap {
switch (maneuver) {
case "TURN_RIGHT":
case "RAMP_RIGHT":
case "FORK_RIGHT":
return "arrow-forward";
case "TURN_LEFT":
case "RAMP_LEFT":
case "FORK_LEFT":
return "arrow-back";
case "TURN_SLIGHT_RIGHT":
case "KEEP_RIGHT":
return "chevron-forward";
case "TURN_SLIGHT_LEFT":
case "KEEP_LEFT":
return "chevron-back";
case "TURN_SHARP_RIGHT":
return "return-up-forward";
case "TURN_SHARP_LEFT":
return "return-up-back";
case "UTURN_RIGHT":
return "return-down-forward";
case "UTURN_LEFT":
return "return-down-back";
case "ROUNDABOUT_RIGHT":
case "ROUNDABOUT_LEFT":
return "refresh-outline";
case "MERGE":
return "git-merge-outline";
case "FERRY":
return "boat-outline";
case "FERRY_TRAIN":
return "train-outline";
default:
return "arrow-up";
}
}
export function getStreetOnlyInstruction(instruction?: string): string {
if (!instruction) return "";
const clean = stripHtmlTags(instruction).trim();
return (
extractAfterKeyword(clean, "onto", ["toward", "for", "to"]) ||
extractAfterKeyword(clean, "toward", ["for"]) ||
extractAfterKeyword(clean, "on", ["toward", "for", "to"]) ||
clean
);
}
function stripHtmlTags(value: string): string {
let out = "";
let inTag = false;
for (const ch of value) {
if (ch === "<") {
inTag = true;
continue;
}
if (ch === ">") {
inTag = false;
continue;
}
if (!inTag) out += ch;
}
return out;
}
function extractAfterKeyword(
source: string,
keyword: string,
stopWords: readonly string[],
): string | null {
const lower = source.toLowerCase();
const key = `${keyword} `;
const start = lower.indexOf(key);
if (start < 0) return null;
let phrase = source.slice(start + key.length).trim();
Iif (!phrase) return null;
const phraseLower = phrase.toLowerCase();
let cutIndex = phrase.length;
for (const stopWord of stopWords) {
const stop = ` ${stopWord} `;
const idx = phraseLower.indexOf(stop);
Iif (idx >= 0 && idx < cutIndex) {
cutIndex = idx;
}
}
phrase = phrase.slice(0, cutIndex).trim();
return phrase || null;
}
|