review utils
parent
3ccdbe4da3
commit
d3f3b3410a
|
@ -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;
|
||||||
|
|
Loading…
Reference in New Issue