Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
var durationFormat = function(ms, strings, precision) {
var oneDay = strings ? ' ' + strings['duration.day'] : ' day';
var days = strings ? ' ' + strings['duration.days'] : ' days';
var oneHour = strings ? ' ' + strings['duration.short.hour'] : ' hour';
var hours = strings ? ' ' + strings['duration.short.hours'] : ' hours';
var oneMinute = strings ? ' ' + strings['duration.short.minute'] : ' min';
var minutes = strings ? ' ' + strings['duration.short.minutes'] : ' mins';
var seconds = strings ? strings['duration.short.seconds'] : 's';
var milliseconds = strings ? strings['duration.short.millisecs'] : 'ms';
var round;
if (_.isUndefined(precision) || _.isNull(precision)) {
precision = 1;
}
if (!isFinite(ms)) {
return ms === Infinity ? '\u221e' : ms === -Infinity ? '-\u221e' : String(ms);
}
var magnitude = Math.abs(ms);
if (magnitude >= 86400e3) {
round = ms / 86400e3;