1.1.1 • Published 3 years ago

human-readable-ms v1.1.1

Weekly downloads
5
License
ISC
Repository
-
Last release
3 years ago

human-readable-ms

Converts a milliseconds value into a human-readable string.

Documentation

/**
 * Converts the given milliseconds to a human-readable String.
 * @param {Number|String} milliseconds - The milliseconds to convert.
 * @param {Object} [options] - Additional options.
 * @param {Boolean} [options.markdown=false] - Whether or not the readable String should include markdown.
 * @param {Boolean} [options.displayMs=false] - Whether or not to display seconds in decimal form (2210 is displayed as 2.21 seconds).
 * @returns {String} The formatted human-readable String.
 */
module.exports = function(milliseconds, options) {
  // ...
}

Examples

const readable_ms = require("human-readable-ms");
readable_ms(345000); // -> "5 minutes and 45 seconds"
readable_ms(2000, { markdown: true }); // -> "**2** seconds"
readable_ms(64240, { markdown: true, displayMs: true }); // -> "**2** seconds"
readable_ms("150"); // -> "0.15 seconds"
1.1.1

3 years ago

1.1.0

3 years ago

1.0.1

3 years ago

1.0.0

3 years ago