parse-duration
Advanced tools
Comparing version
@@ -1,4 +0,37 @@ | ||
// ./index.d.mts | ||
type Units = { | ||
y: 31557600000 | ||
mo: 2629800000 | ||
w: 604800000 | ||
d: 86400000 | ||
h: 3600000 | ||
m: 60000 | ||
s: 1000 | ||
ms: 1 | ||
us: 1e-3 | ||
ns: 1e-6 | ||
[key: string]: number; | ||
} & { | ||
group: string; | ||
decimal: string; | ||
} | ||
declare module './locale/*.js' { | ||
const unit: Units; | ||
export default unit; | ||
} | ||
export * from './index.js' | ||
export { default } from './index.js' | ||
declare const durationRE: RegExp; | ||
declare namespace parse { | ||
const unit: Units; | ||
} | ||
/** | ||
* Convert a string to milliseconds. | ||
* | ||
* @param {string} str - The string to parse. | ||
* @param {string} format - The format to use for conversion (default is 'ms'). | ||
* @returns {number} - The parsed duration in milliseconds. | ||
*/ | ||
declare function parse(str?: string, format?: string): number; | ||
export default parse; |
@@ -6,3 +6,3 @@ import en from './en.js' | ||
unit.jahr = unit.j = en.y | ||
unit.monat = en.month | ||
unit.monat = en.mo | ||
unit.woche = en.w | ||
@@ -9,0 +9,0 @@ unit.tag = unit.t = en.d |
@@ -5,3 +5,3 @@ const unit = Object.create(null) | ||
unit.year = unit.yr = unit.y = y | ||
unit.month = unit.b = y / 12 | ||
unit.month = unit.mth = unit.mo = y / 12 | ||
unit.week = unit.wk = unit.w = d * 7 | ||
@@ -13,4 +13,4 @@ unit.day = unit.d = d | ||
unit.millisecond = unit.millisec = unit.ms = 1 | ||
unit.µs = unit.μs = unit.us = unit.microsecond = 1e-3 | ||
unit.nanosecond = unit.ns = 1e-6 | ||
unit.microsecond = unit.microsec = unit.us = unit.µs = 1e-3 | ||
unit.nanosecond = unit.nanosec = unit.ns = 1e-6 | ||
@@ -17,0 +17,0 @@ unit.group = ',' |
@@ -6,3 +6,3 @@ import en from './en.js' | ||
unit.año = unit.a = en.y | ||
unit.mes = unit.b = en.month | ||
unit.mes = en.mo | ||
unit.semana = en.w | ||
@@ -9,0 +9,0 @@ unit.día = en.d |
@@ -6,3 +6,3 @@ import en from './en.js' | ||
unit.année = unit.an = unit.a = en.y | ||
unit.mois = unit.mo = en.month | ||
unit.mois = en.mo | ||
unit.semaine = unit.sem = en.w | ||
@@ -9,0 +9,0 @@ unit.jour = unit.j = en.d |
@@ -6,3 +6,3 @@ import en from './en.js' | ||
unit.年 = unit.年間 = en.y | ||
unit.月 = unit.ヶ月 = en.month | ||
unit.月 = unit.ヶ月 = en.mo | ||
unit.週 = unit.週間 = en.w | ||
@@ -9,0 +9,0 @@ unit.日 = en.d |
@@ -6,3 +6,3 @@ import en from './en.js' | ||
unit.ano = unit.a = en.y | ||
unit.mês = unit.mes = en.month | ||
unit.mês = unit.mes = en.mo | ||
unit.semana = unit.sem = en.w | ||
@@ -9,0 +9,0 @@ unit.dia = en.d |
@@ -6,3 +6,3 @@ import en from './en.js' | ||
unit.год = unit.г = en.y | ||
unit.месяц = unit.мес = en.month | ||
unit.месяц = unit.мес = en.mo | ||
unit.неделя = unit.нед = en.w | ||
@@ -9,0 +9,0 @@ unit.день = unit.д = en.d |
@@ -6,3 +6,3 @@ import en from './en.js' | ||
unit.年 = en.y | ||
unit.月 = en.month | ||
unit.月 = en.mo | ||
unit.周 = unit.星期 = en.w | ||
@@ -9,0 +9,0 @@ unit.天 = unit.日 = en.d |
{ | ||
"name": "parse-duration", | ||
"version": "2.0.1", | ||
"version": "2.0.2", | ||
"description": "Convert a human readable duration string to a duration format", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
8456
7.73%184
19.48%