New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@ifraan_/pretty-ms

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@ifraan_/pretty-ms

Transform milliseconds to reading time.

  • 1.0.4
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

pretty-ms

CodeFactor NPM-Version NPM-Downloads Github Stars Issues

A simple milliseconds to reading-time function

There are no dependencies nor API key required.

To install use:

npm i @ifraan_/pretty-ms

Examples:

Default

const value = (1003 * 90 * 5 * 10 * 305) - 36000; // random ms
prettyMs(value)
// '15d 22h 23m 1s'
prettyMs(value, { verbose: true })
// '15 days, 22 hours, 23 minutes and 1 second'

Compact

const value = (1003 * 90 * 5 * 10 * 305) - 36000; // random ms
prettyMs(value, { compact: true })
// '15d'
prettyMs(value, { compact: true, verbose: true })
// '15 days'
prettyMs(value, { compact: true, colonNotation: true })
// '15:22:23:01'

Sub Milliseconds

const value = (1000 * 60) + 1500.660005; // random ms
prettyMs(value, { formatSubMilliseconds: true })
// '1m 1s 500ms 660µs 5ns'
prettyMs(value, { formatSubMilliseconds: true, verbose: true })
// '1 minute, 1 second, 500 milliseconds, 660 microseconds and 5 nanoseconds'

Multiple languages

prettyMs(value, { verbose: true, lang: 'en' }); // english
// '15 days, 22 hours, 23 minutes and 1 second'
prettyMs(value, { verbose: true, lang: 'es' }); // spanish
// '15 días, 22 horas, 23 minutos y 1 segundo'
prettyMs(value, { verbose: true, lang: 'pt' }); // portuguese
// '15 dias, 22 horas, 23 minutos e 1 segundo'

Keywords

FAQs

Package last updated on 10 Apr 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc