n2words 1.10.1 → 1.12.0
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/.eslintrc.json +2 -1
- package/CHANGELOG.md +25 -0
- package/README.md +20 -21
- package/dist/n2words.js +1 -1
- package/lib/i18n/HR.mjs +117 -0
- package/lib/i18n/SR.mjs +9 -9
- package/lib/i18n/VI.mjs +145 -0
- package/lib/n2words.mjs +8 -0
- package/package.json +16 -14
- package/webpack.config.js +1 -4
package/.eslintrc.json
CHANGED
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
"es2017": true,
|
|
7
7
|
"es2020": true,
|
|
8
8
|
"es2021": true,
|
|
9
|
+
"es2022": true,
|
|
9
10
|
"node": true
|
|
10
11
|
},
|
|
11
12
|
"plugins": [
|
|
@@ -26,7 +27,7 @@
|
|
|
26
27
|
"files": ["*.js", "*.mjs"]
|
|
27
28
|
}],
|
|
28
29
|
"parserOptions": {
|
|
29
|
-
"ecmaVersion":
|
|
30
|
+
"ecmaVersion": "latest",
|
|
30
31
|
"sourceType": "module"
|
|
31
32
|
},
|
|
32
33
|
"rules": {
|
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,31 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
|
5
5
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
6
6
|
|
|
7
7
|
|
|
8
|
+
## [1.12.0] - 2022-09-01
|
|
9
|
+
|
|
10
|
+
### Added
|
|
11
|
+
- New language: `vi` Vietnamese [#69](https://github.com/forzagreen/n2words/pull/69).
|
|
12
|
+
|
|
13
|
+
### Changed
|
|
14
|
+
- Bump dev dependencies [#68](https://github.com/forzagreen/n2words/pull/68). Thanks to [@TylerVigario](https://github.com/TylerVigario) !
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
## [1.11.1] - 2022-04-08
|
|
18
|
+
|
|
19
|
+
### Changed
|
|
20
|
+
- Improve README [#67](https://github.com/forzagreen/n2words/pull/67) [#66](https://github.com/forzagreen/n2words/pull/66). Thanks to [@TylerVigario](https://github.com/TylerVigario) !
|
|
21
|
+
- Update dev dependencies (Webpack, ESLint...) [#65](https://github.com/forzagreen/n2words/pull/65). Thanks to [@TylerVigario](https://github.com/TylerVigario) !
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
## [1.11.0] - 2022-01-08
|
|
25
|
+
|
|
26
|
+
### Added
|
|
27
|
+
- New language: `hr` Croatian [#61](https://github.com/forzagreen/n2words/pull/61). Thanks to [@lagavuliner](https://github.com/lagavuliner) !
|
|
28
|
+
|
|
29
|
+
### Fixed
|
|
30
|
+
- Fix translations for Serbian [#60](https://github.com/forzagreen/n2words/pull/60) [#61](https://github.com/forzagreen/n2words/pull/61). Thanks to [@lagavuliner](https://github.com/lagavuliner) !
|
|
31
|
+
|
|
32
|
+
|
|
8
33
|
## [1.10.1] - 2021-10-31
|
|
9
34
|
|
|
10
35
|
### Fixed
|
package/README.md
CHANGED
|
@@ -3,12 +3,11 @@
|
|
|
3
3
|
[](https://github.com/forzagreen/n2words/actions)
|
|
4
4
|
[](https://coveralls.io/github/forzagreen/n2words?branch=master)
|
|
5
5
|
[](https://npmjs.com/package/n2words)
|
|
6
|
-
[](https://npmjs.com/package/n2words)
|
|
7
7
|
|
|
8
|
-
n2words converts
|
|
9
|
-
|
|
10
|
-
n2words is a lightweight, easy to use package, with no dependencies. It works both in Node.js and in browsers.
|
|
8
|
+
n2words is a library that converts a numerical number into a written number.
|
|
11
9
|
|
|
10
|
+
We have support for multiple languages (26 and growing) and our package is lightweight, modular and has no dependencies.
|
|
12
11
|
|
|
13
12
|
## How To
|
|
14
13
|
|
|
@@ -21,17 +20,28 @@ n2words(123, {lang: 'es'}) // 'ciento veintitrés'
|
|
|
21
20
|
n2words(123, {lang: 'ar'}) // 'مائة و ثلاثة و عشرون'
|
|
22
21
|
```
|
|
23
22
|
|
|
24
|
-
|
|
25
23
|
## Install
|
|
26
24
|
|
|
27
25
|
```sh
|
|
28
26
|
npm install n2words
|
|
29
27
|
```
|
|
30
28
|
|
|
31
|
-
n2words is available on [jsDelivr](https://jsdelivr.com/package/npm/n2words).
|
|
29
|
+
n2words is also available on [jsDelivr](https://jsdelivr.com/package/npm/n2words).
|
|
32
30
|
|
|
33
31
|
## Usage
|
|
34
32
|
|
|
33
|
+
### ESM
|
|
34
|
+
|
|
35
|
+
```js
|
|
36
|
+
import n2words from 'n2words'
|
|
37
|
+
|
|
38
|
+
// Source file
|
|
39
|
+
import n2words from 'n2words/lib/n2words.mjs'
|
|
40
|
+
|
|
41
|
+
// Individual languages (recommended)
|
|
42
|
+
import n2wordsEN from 'n2words/lib/i18n/EN.mjs'
|
|
43
|
+
```
|
|
44
|
+
|
|
35
45
|
### CommonJS
|
|
36
46
|
|
|
37
47
|
```js
|
|
@@ -49,18 +59,6 @@ import('n2words/lib/i18n/EN.mjs').then(n2wordsEN => {
|
|
|
49
59
|
})
|
|
50
60
|
```
|
|
51
61
|
|
|
52
|
-
### ESM
|
|
53
|
-
|
|
54
|
-
```js
|
|
55
|
-
import n2words from 'n2words'
|
|
56
|
-
|
|
57
|
-
// ES6+
|
|
58
|
-
import n2words from 'n2words/lib/n2words.mjs'
|
|
59
|
-
|
|
60
|
-
// Individual languages
|
|
61
|
-
import n2wordsEN from 'n2words/lib/i18n/EN.mjs'
|
|
62
|
-
```
|
|
63
|
-
|
|
64
62
|
### Browser
|
|
65
63
|
|
|
66
64
|
```html
|
|
@@ -84,6 +82,7 @@ import n2wordsEN from 'n2words/lib/i18n/EN.mjs'
|
|
|
84
82
|
- `fr` (French)
|
|
85
83
|
- `fa` (Farsi)
|
|
86
84
|
- `he` (Hebrew)
|
|
85
|
+
- `hr` (Croatian)
|
|
87
86
|
- `hu` (Hungarian)
|
|
88
87
|
- `id` (Indonesian)
|
|
89
88
|
- `it` (Italian)
|
|
@@ -98,14 +97,14 @@ import n2wordsEN from 'n2words/lib/i18n/EN.mjs'
|
|
|
98
97
|
- `sr` (Serbian)
|
|
99
98
|
- `tr` (Turkish)
|
|
100
99
|
- `uk` (Ukrainian)
|
|
100
|
+
- `vi` (Vietnamese)
|
|
101
101
|
- `zh` (Chinese)
|
|
102
102
|
|
|
103
|
-
|
|
104
103
|
## Contributing
|
|
105
104
|
|
|
106
|
-
You can help by adding
|
|
105
|
+
You can help by adding new languages or by improving existing ones. Also, reporting issues, verifying the correctness of unit tests or adding more test cases is extremely helpful.
|
|
107
106
|
|
|
108
|
-
All help is welcome
|
|
107
|
+
All help is welcome!
|
|
109
108
|
|
|
110
109
|
## License
|
|
111
110
|
|