Skip to content

Commit

Permalink
Switch export method
Browse files Browse the repository at this point in the history
  • Loading branch information
joao-vasconcelos committed Aug 29, 2024
1 parent ef5fc8e commit aab6fa9
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions lib/makeText.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
function titleCase(str) {
let splitStr = str.toLowerCase().split(' ');
const splitStr = str.toLowerCase().split(' ');
for (let i = 0; i < splitStr.length; i++) {
// You do not need to check if i is larger than splitStr length, as your for does that for you
// Assign it back to the array
Expand Down Expand Up @@ -585,7 +585,7 @@ function createPhoneticText(p) {
regex = /\b(Av[e]?[n]?[\.]?[aª]?)(\s|$)/giu;
thisString = thisString.replace(regex, 'Avenida$2');
regex = /(?<!Rua|Avenida|Alameda|Praceta|Travessa|Estrada)(\s|^)R[\.]?(\s)/iu;
let regex2
const regex2
= /(Rua|Avenida|Alameda|Praceta|Travessa|Estrada)[\s]+[^\s\)\/]+[\s]+R[\.]?\s/iu;
while (thisString.match(regex) && !thisString.match(regex2)) {
thisString = thisString.replace(regex, ' Rua$2');
Expand Down Expand Up @@ -1323,7 +1323,7 @@ function numericShortName(lineShortName) {
//
}

module.exports.makeStop = (stopString, transferModes = {}) => {
export const makeStop = (stopString, transferModes = {}) => {
let thisString = stopString;
thisString = createPhoneticText(thisString);
thisString = addTransfer(thisString, transferModes);
Expand All @@ -1333,7 +1333,7 @@ module.exports.makeStop = (stopString, transferModes = {}) => {
return thisString.replace(/\s+/g, ' ');
};

module.exports.makeLine = (lineShortName, lineLongName) => {
export const makeLine = (lineShortName, lineLongName) => {
const lineShortNameTts = numericShortName(lineShortName);
const headsignTts = createPhoneticText(lineLongName);
let thisString = `Linha ${lineShortNameTts} com percurso ${headsignTts}`;
Expand All @@ -1343,7 +1343,7 @@ module.exports.makeLine = (lineShortName, lineLongName) => {
return thisString.replace(/\s+/g, ' ');
};

module.exports.makeRoute = (lineShortName, routeLongName) => {
export const makeRoute = (lineShortName, routeLongName) => {
const lineShortNameTts = numericShortName(lineShortName);
const headsignTts = createPhoneticText(routeLongName);
let thisString = `Linha ${lineShortNameTts} com percurso ${headsignTts}`;
Expand All @@ -1353,7 +1353,7 @@ module.exports.makeRoute = (lineShortName, routeLongName) => {
return thisString.replace(/\s+/g, ' ');
};

module.exports.makePattern = (lineShortName, patternHeadsign) => {
export const makePattern = (lineShortName, patternHeadsign) => {
const lineShortNameTts = numericShortName(lineShortName);
const headsignTts = createPhoneticText(patternHeadsign);
let thisString = `Linha ${lineShortNameTts} com destino a ${headsignTts}`;
Expand All @@ -1363,5 +1363,5 @@ module.exports.makePattern = (lineShortName, patternHeadsign) => {
return thisString.replace(/\s+/g, ' ');
};

module.exports.makeText = module.exports.makeStop;
export const makeText = module.exports.makeStop;
/* Backwards compatibility */

0 comments on commit aab6fa9

Please sign in to comment.