Skip to content
This repository has been archived by the owner on May 1, 2023. It is now read-only.

Update index.js to support IE #56

Merged
merged 1 commit into from
Nov 9, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions src/index.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module.exports = {
compareTwoStrings,
findBestMatch
compareTwoStrings:compareTwoStrings,
findBestMatch:findBestMatch
};

function compareTwoStrings(first, second) {
Expand Down Expand Up @@ -57,13 +57,13 @@ function findBestMatch(mainString, targetStrings) {

const bestMatch = ratings[bestMatchIndex]

return { ratings, bestMatch, bestMatchIndex };
return { ratings: ratings, bestMatch: bestMatch, bestMatchIndex: bestMatchIndex };
}

function areArgsValid(mainString, targetStrings) {
if (typeof mainString !== 'string') return false;
if (!Array.isArray(targetStrings)) return false;
if (!targetStrings.length) return false;
if (targetStrings.find(s => typeof s !== 'string')) return false;
if (targetStrings.find( function (s) { return typeof s !== 'string'})) return false;
return true;
}