Home
Docs
GitHub
Pricing
Blog
Log In

Run Sandworm Audit for your App

Get started
Generated on Apr 29, 2024 via pnpm

ms 0.5.0

Tiny ms conversion utility
Package summary
Share
6
issues
1
critical severity
license
1
2
high severity
vulnerability
2
3
moderate severity
vulnerability
2
meta
1
1
license
1
N/A
Package created
21 Dec 2011
Version published
10 Nov 2012
Maintainers
7
Total deps
1
Direct deps
0
License
UNKNOWN

Issues

6

1 critical severity issue

critical
Recommendation: Check the package code and files for license information
via: ms@0.5.0
Collapse
Expand

2 high severity issues

high
Recommendation: Upgrade to version 0.7.1 or later
via: ms@0.5.0
Recommendation: Upgrade to version 0.7.1 or later
via: ms@0.5.0
Collapse
Expand

3 moderate severity issues

moderate
Recommendation: Upgrade to version 2.0.0 or later
via: ms@0.5.0
Recommendation: Upgrade to version 2.0.0 or later
via: ms@0.5.0
via: ms@0.5.0
Collapse
Expand

Licenses

N/A

N/A
1 Packages, Including:
ms@0.5.0
Disclaimer

This deed highlights only some of the key features and terms of the actual license. It is not a license and has no legal value. You should carefully review all of the terms and conditions of the actual license before using the licensed material.

Sandworm is not a law firm and does not provide legal services. Distributing, displaying, or linking to this deed or the license that it summarizes does not create a lawyer-client or any other relationship.

Direct Dependencies

0
All Dependencies CSV
β“˜ This is a list of ms 's direct dependencies. Data on all dependencies, including transitive ones, is available via CSV download.
NameVersionSizeLicenseTypeVulnerabilities

Visualizations

Frequently Asked Questions

What does ms do?

The 'ms' npm package is a diminutive utility designed for the express purpose of converting various time formats into milliseconds. This tool is handy in situations where calculations or operations integral to the function of your program or application require input in the form of milliseconds. The 'ms' package works on both Node.js and in-browser environments, robustly interpreting a variety of time expressions. For example, it can convert full written-out time durations - '2 days', '1 hour', etc - and abbreviated inputs - '1d', '10h', etc.

How do you use ms?

Usage of the 'ms' library is refreshingly straightforward. It can be invoked within your JavaScript code by simply calling the ms() function. This function takes one mandatory argument, which is the time duration (in any format) that you want to convert to milliseconds. Additionally, there is an optional argument that configures whether the output should be in a long-fully-written-out format.

Here are examples to demonstrate how to use 'ms':

To get the equivalent milliseconds for a time duration:

const ms = require('ms');
console.log(ms('2 days'));  // Outputs: 172800000
console.log(ms('1d'));      // Outputs: 86400000
console.log(ms('10h'));     // Outputs: 36000000

To convert from milliseconds to time duration:

console.log(ms(60000));             // Outputs: "1m"
console.log(ms(2 * 60000));         // Outputs: "2m"
console.log(ms(-3 * 60000));        // Outputs: "-3m"
console.log(ms(ms('10 hours')));    // Outputs: "10h"

To get the converted duration in a long format:

console.log(ms(60000, { long: true }));             // Outputs: "1 minute"
console.log(ms(2 * 60000, { long: true }));         // Outputs: "2 minutes"
console.log(ms(-3 * 60000, { long: true }));        // Outputs: "-3 minutes"
console.log(ms(ms('10 hours'), { long: true }));    // Outputs: "10 hours"

Where are the ms docs?

The 'ms' package's documentation can be found within its readme on the official GitHub page of the package. The link to the page is https://github.com/vercel/ms. The readme contains comprehensive information on the usage of the 'ms' package in various cases, as well as details on features and examples of code snippets.