Skip to content

Commit

Permalink
Web App (Assessing): Issue #2182 - wip #2
Browse files Browse the repository at this point in the history
  • Loading branch information
phillipbentonkelly committed Sep 21, 2021
1 parent 41c8f9d commit 1e1a6e5
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 4 deletions.

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ class MNL extends React.Component {
{ abbr: 'TE', label: 'Terrace' },
{ abbr: 'WY', label: 'Way' },
],
aptUnitLabels: ["apt", "apt.", "unit", "#"],
aptUnitLabels: ["apt", "apt.", "unit", "unit.", "#"],
validationMgs: "",
postResMessage: ""
};
Expand Down Expand Up @@ -268,14 +268,26 @@ class MNL extends React.Component {
* returns {index: -1, value: ""}
*/
findAptUnitInAddress = addressArr => {
const { aptUnitLabels } = this.state;
let retObj = { index: -1, value: '' };

const index = addressArr.findIndex(element => {
return this.state.aptUnitLabels.find(elem => elem === element.toLowerCase())
return aptUnitLabels.find(elem => {
const elementLCase = element.toLocaleLowerCase();
const elemLCase = elem.toLowerCase();
return elemLCase === element.toLowerCase() || elementLCase.indexOf(elemLCase) > -1
});
});

retObj.index = index;
retObj.value = addressArr[index];

// if (retObj.index > -1 && addressArr[retObj.index].match(/\d+/g) !== null) {

// }

// console.log('findAptUnitInAddress > retObj: ', retObj, addressArr);

return retObj;
}

Expand Down

0 comments on commit 1e1a6e5

Please sign in to comment.