UNPKG

tfl-api-wrapper

Version:

A Node JS wrapper for the Transport for London API

31 lines (30 loc) 960 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.trackerNetRetag = void 0; function trackerNetRetag(xml) { // Orginal Tag and replacement tag var tagsToReplace = { '<S': '<Station', '<P N=': '<Platform Name=', '<T S=': '<Train SetNumber=', '<T TrainId=': '<Train TrainId=', '<T LCID=': '<Train LeadingCarID=', 'C=': 'TimeToStation=', 'D=': 'Destination=', 'DE=': 'DestCode=', 'L=': 'CurrentStation=', 'LCID=': 'LeadingCarID=', 'LN=': 'Line=', 'N=': 'Name=', 'T=': 'TripNumber=', SecondsTo: 'SecondsToStation', '</S>': '</Station>', '</P>': '</Platform>' }; // Replace xml tags for (var tag in tagsToReplace) { xml = xml.replace(new RegExp(tag, 'g'), tagsToReplace[tag]); } return xml; } exports.trackerNetRetag = trackerNetRetag;