review utils

pull/15/head
HardiReady 2017-10-26 19:12:54 +02:00
parent 3ccdbe4da3
commit d3f3b3410a
1 changed files with 4 additions and 4 deletions

View File

@ -11,11 +11,11 @@ const sortCollectionBy = (collection, key) => {
return collection; return collection;
}; };
const playerArrayContains = (arr, item) => { const arrayContains = (arr, item) => {
let i = 0, count = arr.length, matchFound = false; let i = 0, count = arr.length, matchFound = false;
for (; i < count; i++) { for (; i < count; i++) {
if (arr[i].name === item.name && arr[i].fraction === item.fraction) { if (arr[i] === item) {
matchFound = true; matchFound = true;
break; break;
} }
@ -29,7 +29,7 @@ const timeStringToDecimal = (timeString) => {
const hour = parseInt(timeArray[0]); const hour = parseInt(timeArray[0]);
const sek = parseInt(timeArray[1]) * 60 + parseInt(timeArray[2]); const sek = parseInt(timeArray[1]) * 60 + parseInt(timeArray[2]);
return hour + sek * (1 / 3600); return hour + (sek / 3600);
}; };
@ -45,6 +45,6 @@ const decimalToTimeString = (decimal) => {
}; };
exports.sortCollection = sortCollectionBy; exports.sortCollection = sortCollectionBy;
exports.arrayContains = playerArrayContains; exports.arrayContains = arrayContains;
exports.timeStringToDecimal = timeStringToDecimal; exports.timeStringToDecimal = timeStringToDecimal;
exports.decimalToTimeString = decimalToTimeString; exports.decimalToTimeString = decimalToTimeString;