1- ![ License] ( https://img.shields.io/npm/l/ms-relative ) [ ![ npm] ( https://img.shields.io/npm/v/ms-relative?cv=0.0.4 )] ( https://www.npmjs.com/package/ms-relative )
2- [ ![ JSR] ( https://jsr.io/badges/@wilcosp/ms-relative?cv=0.0.4 )] ( https://jsr.io/@wilcosp/ms-relative )
3- [ ![ Vitest] ( https://github.com/wilcosp/ms-relative/actions/workflows/vitest.yml/badge.svg?cv=0.0.4 )] ( https://github.com/wilcosp/ms-relative/actions/workflows/test.yml )
4- [ ![ npm bundle size] ( https://img.shields.io/bundlephobia/minzip/ms-relative?color=green&cv=0.0.4 )] ( https://bundlephobia.com/package/ms-relative )
5- [ ![ GitHub Repo stars] ( https://img.shields.io/github/stars/wilcosp/ms-relative?style=flat&logo=github&color=green&cv=0.0.4 )] ( https://github.com/WilcoSp/ms-relative )
1+ ![ License] ( https://img.shields.io/npm/l/ms-relative ) [ ![ npm] ( https://img.shields.io/npm/v/ms-relative?cv=0.0.5 )] ( https://www.npmjs.com/package/ms-relative )
2+ [ ![ JSR] ( https://jsr.io/badges/@wilcosp/ms-relative?cv=0.0.5 )] ( https://jsr.io/@wilcosp/ms-relative )
3+ [ ![ Vitest] ( https://github.com/wilcosp/ms-relative/actions/workflows/vitest.yml/badge.svg?cv=0.0.5 )] ( https://github.com/wilcosp/ms-relative/actions/workflows/test.yml )
4+ [ ![ npm bundle size] ( https://img.shields.io/bundlephobia/minzip/ms-relative?color=green&cv=0.0.5 )] ( https://bundlephobia.com/package/ms-relative )
5+ [ ![ GitHub Repo stars] ( https://img.shields.io/github/stars/wilcosp/ms-relative?style=flat&logo=github&color=green&cv=0.0.5 )] ( https://github.com/WilcoSp/ms-relative )
66
77# ms-relative
88
@@ -46,9 +46,9 @@ deno add @wilcosp/ms-relative
4646
4747### Via cdn
4848
49- - Jsdelivr:
https://cdn.jsdelivr.net/npm/[email protected] .4 50- - Esm.sh:
https://esm.sh/[email protected] .4 51- - Unpkg:
https://unpkg.com/[email protected] .4 49+ - Jsdelivr:
https://cdn.jsdelivr.net/npm/[email protected] .5 50+ - Esm.sh:
https://esm.sh/[email protected] .5 51+ - Unpkg:
https://unpkg.com/[email protected] .5 5252
5353# Examples
5454
@@ -61,7 +61,7 @@ import { second, minute, hour, day, week, year } from "ms-relative" // for npm
6161// or
6262import { second , minute , hour , day , week , year } from " @wilcosp/ms-relative" // for jsr
6363// or
64- import {
second ,
minute ,
hour ,
day ,
week ,
year }
from ` https://cdn.jsdelivr.net/npm/[email protected] .4 64+ import {
second ,
minute ,
hour ,
day ,
week ,
year }
from ` https://cdn.jsdelivr.net/npm/[email protected] .5 6565
6666second // amount of ms in a second
6767minute // amount of ms in a minute
@@ -81,7 +81,7 @@ import { format, day, second, year, week } from "ms-relative" // for npm
8181// or
8282import { format, day, second, year, week } from "@wilcosp/ms-relative" // for jsr
8383// or
84- import { format, day, second, year, week } from ` https :
// cdn.jsdelivr.net/npm/[email protected] .4 ` // cdn (can also be esm.sh or unpkg)84+ import { format, day, second, year, week } from ` https :
// cdn.jsdelivr.net/npm/[email protected] .5 ` // cdn (can also be esm.sh or unpkg)8585
8686format (1080003000 , { style: " long" , locale: " en-US" }) => " 5 days 3 seconds"
8787format (5 * day + 3 * second , { style: " long" , locale: " en-US" }) => " 5 days 3 seconds"
@@ -99,7 +99,7 @@ import { formatList, day, second, year, week } from "ms-relative" // for npm
9999// or
100100import { format , day , second , year , week } from " @wilcosp/ms-relative" // for jsr
101101// or
102- import {
format ,
day ,
second ,
year ,
week }
from ` https://esm.sh/[email protected] .4 ` // cdn (can also be jsdelivr or unpkg)102+ import {
format ,
day ,
second ,
year ,
week }
from ` https://esm.sh/[email protected] .5 ` // cdn (can also be jsdelivr or unpkg)103103
104104formatList (1080003000 , { relativeStyle: " long" , listStyle: " long" , locale: " en-US" }) => " 5 days and 3 seconds"
105105formatList (5 * day + 3 * second , { relativeStyle: " long" , listStyle: " short" , locale: " en-US" }) => " 5 days & 3 seconds"
@@ -119,7 +119,7 @@ import { parseToMs } from "ms-relative" // for npm
119119// or
120120import { parseToMs } from " @wilcosp/ms-relative" // for jsr
121121// or
122- import {
parseToMs }
from ` https://esm.sh/[email protected] .4 ` // cdn (can also be jsdelivr or unpkg)122+ import {
parseToMs }
from ` https://esm.sh/[email protected] .5 ` // cdn (can also be jsdelivr or unpkg)123123
124124parseToMs (" year 5 days 10 minutes" , { locale: " en-US" , style: " long" }) => 79_974_600_000
125125
@@ -134,7 +134,7 @@ import { msToMap, msToObject, year, minute } from "ms-relative"; // for npm
134134// or
135135import { msToMap , msToObject , year , minute } from " @wilcosp/ms-relative" ; // for jsr
136136// or
137- import {
msToMap ,
msToObject ,
year ,
minute }
from " https://unpkg.com/[email protected] .4 " ;
// cdn, can also be used with jsdelivr or esn.sh137+ import {
msToMap ,
msToObject ,
year ,
minute }
from " https://unpkg.com/[email protected] .5 " ;
// cdn, can also be used with jsdelivr or esn.sh138138
139139msToMap (year * 6 + minute * 4 ) => Map ([ [" year" , 6 ], [" minute" , 4 ] ])
140140
0 commit comments