lunaisadev-website-old/node_modules/parse-ms/index.js

15 lines
335 B
JavaScript
Raw Normal View History

2021-07-28 01:40:12 +00:00
'use strict';
module.exports = function (ms) {
if (typeof ms !== 'number') {
throw new TypeError('Expected a number');
}
return {
days: Math.floor(ms / 86400000),
hours: Math.floor(ms / 3600000 % 24),
minutes: Math.floor(ms / 60000 % 60),
seconds: Math.floor(ms / 1000 % 60),
milliseconds: Math.floor(ms % 1000)
};
};