0.9.0 • Published 2 years ago

multiple-ms v0.9.0

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

Multiple ms

Convert a string to milliseconds with a simple format.

Install

$ npm install multiple-ms

Examples

const parse = require('multiple-ms');

parse('1 hour'); // 3600000
parse('1_100 s'); // 1100000
parse('3d', true); // 3 days
parse('2w hi', { strict: true }); // NaN
parse('2h, 30m hi 80 hours', { separator: ', ' }); // 9000000
parse('2h 30m', { separator: ', ', strict: true }); // NaN
parse('2 h', { language: 'es', length: true }); // 2 horas
parse('2 horas', { language: 'en', strict: true }); // NaN

Usage

ParameterTypeRequiredDescription
strstringThe string to convert to milliseconds.
optionsboolean or ParseOptionsThe conversion options.

ParseOptions

All properties are optional.

PropertyTypeDescription
languagestringThe language that will be used for the conversion.
separatorstring or string[]The strings separator.
strictbooleanIf the conversion run on strict mode.
lengthbooleanIf the result is converted to string.

License

MIT © Cristo

0.9.0

2 years ago

0.8.7

2 years ago

0.8.5

2 years ago

0.8.2

2 years ago

0.8.1

2 years ago

0.8.0

2 years ago

0.7.5

2 years ago

0.5.1

2 years ago

0.5.0

2 years ago