@visulima/humanizer 1.0.0 → 1.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +20 -5
- package/package.json +6 -6
package/README.md
CHANGED
|
@@ -671,7 +671,7 @@ duration(97320000);
|
|
|
671
671
|
|
|
672
672
|
You can change the settings by passing options as the second argument.
|
|
673
673
|
|
|
674
|
-
#####
|
|
674
|
+
##### units
|
|
675
675
|
|
|
676
676
|
Array of possible units to use. Units are `y`, `mo`, `w`, `d`, `h`, `m`, `s`, and `ms`.
|
|
677
677
|
|
|
@@ -869,11 +869,26 @@ duration(2629800000, {
|
|
|
869
869
|
// => "1 month, 10 hours, 30 minutes"
|
|
870
870
|
```
|
|
871
871
|
|
|
872
|
-
|
|
872
|
+
#### language
|
|
873
873
|
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
874
|
+
Language for unit display.
|
|
875
|
+
Accepts an [ISO 639-1 code](https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes) from one of the [supported languages](#supported-languages).
|
|
876
|
+
|
|
877
|
+
Default: `"en"`.
|
|
878
|
+
|
|
879
|
+
```js
|
|
880
|
+
import { duration } from "@visulima/humanizer";
|
|
881
|
+
import { durationLanguage as es } from "@visulima/humanizer/language/es";
|
|
882
|
+
import { durationLanguage as ko } from "@visulima/humanizer/language/ko";
|
|
883
|
+
|
|
884
|
+
duration(3000, { language: es });
|
|
885
|
+
// => "3 segundos"
|
|
886
|
+
|
|
887
|
+
duration(5000, { language: ko });
|
|
888
|
+
// => "5 초"
|
|
889
|
+
```
|
|
890
|
+
|
|
891
|
+
###### Supported languages
|
|
877
892
|
|
|
878
893
|
`duration` supports the following languages:
|
|
879
894
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@visulima/humanizer",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.1",
|
|
4
4
|
"description": "Humanizer is a library for humanizing data in a human-readable form.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"visulima",
|
|
@@ -66,14 +66,14 @@
|
|
|
66
66
|
"default": "./dist/index.js"
|
|
67
67
|
}
|
|
68
68
|
},
|
|
69
|
-
"./
|
|
69
|
+
"./language/*": {
|
|
70
70
|
"require": {
|
|
71
|
-
"types": "./dist/language
|
|
72
|
-
"default": "./dist/language
|
|
71
|
+
"types": "./dist/language/*.d.cts",
|
|
72
|
+
"default": "./dist/language/*.cjs"
|
|
73
73
|
},
|
|
74
74
|
"import": {
|
|
75
|
-
"types": "./dist/language
|
|
76
|
-
"default": "./dist/language
|
|
75
|
+
"types": "./dist/language/*.d.ts",
|
|
76
|
+
"default": "./dist/language/*.js"
|
|
77
77
|
}
|
|
78
78
|
},
|
|
79
79
|
"./package.json": "./package.json"
|