MCPcopy
hub / github.com/socketio/socket.io / fmtShort

Function fmtShort

packages/socket.io/client-dist/socket.io.js:2463–2478  ·  view source on GitHub ↗

* Short format for `ms`. * * @param {Number} ms * @return {String} * @api private

(ms)

Source from the content-addressed store, hash-verified

2461 */
2462
2463 function fmtShort(ms) {
2464 var msAbs = Math.abs(ms);
2465 if (msAbs >= d) {
2466 return Math.round(ms / d) + 'd';
2467 }
2468 if (msAbs >= h) {
2469 return Math.round(ms / h) + 'h';
2470 }
2471 if (msAbs >= m) {
2472 return Math.round(ms / m) + 'm';
2473 }
2474 if (msAbs >= s) {
2475 return Math.round(ms / s) + 's';
2476 }
2477 return ms + 'ms';
2478 }
2479
2480 /**
2481 * Long format for `ms`.

Callers 1

requireMsFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected