This commit is contained in:
Koen Kanters
2020-06-15 20:10:30 +02:00
parent 79b4dbd24f
commit f8d082e18d
4 changed files with 103 additions and 16 deletions
+9
View File
@@ -142,6 +142,14 @@ function getResponse(request, data, error) {
return response;
}
function parseJSON(value, failedReturnValue) {
try {
return JSON.parse(value);
} catch (e) {
return failedReturnValue;
}
}
module.exports = {
millisecondsToSeconds: (milliseconds) => milliseconds / 1000,
secondsToMilliseconds: (seconds) => seconds * 1000,
@@ -160,4 +168,5 @@ module.exports = {
equalsPartial,
getResponse,
capitalize,
parseJSON,
};