n2words 1.10.0 → 1.11.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/.eslintrc.json +2 -1
- package/CHANGELOG.md +23 -0
- package/README.md +18 -20
- package/dist/n2words.js +1 -1
- package/lib/classes/N2WordsAbs.mjs +5 -4
- package/lib/i18n/EN.mjs +1 -1
- package/lib/i18n/HR.mjs +117 -0
- package/lib/i18n/NL.mjs +1 -1
- package/lib/i18n/SR.mjs +9 -9
- package/lib/n2words.mjs +4 -0
- package/package.json +15 -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,29 @@ 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.11.1] - 2022-04-08
|
|
9
|
+
|
|
10
|
+
### Changed
|
|
11
|
+
- 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) !
|
|
12
|
+
- Update dev dependencies (Webpack, ESLint...) [#65](https://github.com/forzagreen/n2words/pull/65). Thanks to [@TylerVigario](https://github.com/TylerVigario) !
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
## [1.11.0] - 2022-01-08
|
|
16
|
+
|
|
17
|
+
### Added
|
|
18
|
+
- New language: `hr` Croatian [#61](https://github.com/forzagreen/n2words/pull/61). Thanks to [@lagavuliner](https://github.com/lagavuliner) !
|
|
19
|
+
|
|
20
|
+
### Fixed
|
|
21
|
+
- 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) !
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
## [1.10.1] - 2021-10-31
|
|
25
|
+
|
|
26
|
+
### Fixed
|
|
27
|
+
- Correct translation of number 18 for NL.mjs [#59](https://github.com/forzagreen/n2words/pull/59). Thanks to [@K4CZP3R](https://github.com/K4CZP3R) !
|
|
28
|
+
- Update dev dependencies.
|
|
29
|
+
|
|
30
|
+
|
|
8
31
|
## [1.10.0] - 2021-08-22
|
|
9
32
|
### Added
|
|
10
33
|
- New language: `id` Indonesian [#58](https://github.com/forzagreen/n2words/pull/58).
|
package/README.md
CHANGED
|
@@ -3,11 +3,20 @@
|
|
|
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
|
|
8
|
+
n2words is a library that converts a numerical number into a written number. We have support for multiple languages (25 and growing) and our package is lightweight, modular and has no dependencies.
|
|
9
9
|
|
|
10
|
-
|
|
10
|
+
## How To
|
|
11
|
+
|
|
12
|
+
```js
|
|
13
|
+
n2words(123) // 'one hundred and twenty-three'
|
|
14
|
+
n2words(-1.5) // 'minus one point five'
|
|
15
|
+
|
|
16
|
+
n2words(123, {lang: 'fr'}) // 'cent vingt-trois'
|
|
17
|
+
n2words(123, {lang: 'es'}) // 'ciento veintitrés'
|
|
18
|
+
n2words(123, {lang: 'ar'}) // 'مائة و ثلاثة و عشرون'
|
|
19
|
+
```
|
|
11
20
|
|
|
12
21
|
## Install
|
|
13
22
|
|
|
@@ -15,7 +24,7 @@ n2words is a lightweight, easy to use package, with no dependencies. It works bo
|
|
|
15
24
|
npm install n2words
|
|
16
25
|
```
|
|
17
26
|
|
|
18
|
-
n2words is available on [jsDelivr](https://jsdelivr.com/package/npm/n2words).
|
|
27
|
+
n2words is also available on [jsDelivr](https://jsdelivr.com/package/npm/n2words).
|
|
19
28
|
|
|
20
29
|
## Usage
|
|
21
30
|
|
|
@@ -41,10 +50,10 @@ import('n2words/lib/i18n/EN.mjs').then(n2wordsEN => {
|
|
|
41
50
|
```js
|
|
42
51
|
import n2words from 'n2words'
|
|
43
52
|
|
|
44
|
-
//
|
|
53
|
+
// Source file
|
|
45
54
|
import n2words from 'n2words/lib/n2words.mjs'
|
|
46
55
|
|
|
47
|
-
// Individual languages
|
|
56
|
+
// Individual languages (recommended)
|
|
48
57
|
import n2wordsEN from 'n2words/lib/i18n/EN.mjs'
|
|
49
58
|
```
|
|
50
59
|
|
|
@@ -54,17 +63,6 @@ import n2wordsEN from 'n2words/lib/i18n/EN.mjs'
|
|
|
54
63
|
<script src="n2words.js"></script>
|
|
55
64
|
```
|
|
56
65
|
|
|
57
|
-
## Example
|
|
58
|
-
|
|
59
|
-
```js
|
|
60
|
-
n2words(123) // 'one hundred and twenty-three'
|
|
61
|
-
n2words(-1.5) // 'minus one point five'
|
|
62
|
-
|
|
63
|
-
n2words(123, {lang: 'en'}) // 'one hundred and twenty-three'
|
|
64
|
-
n2words(123, {lang: 'fr'}) // 'cent vingt-trois'
|
|
65
|
-
n2words(123, {lang: 'es'}) // 'ciento veintitrés'
|
|
66
|
-
```
|
|
67
|
-
|
|
68
66
|
## Features
|
|
69
67
|
|
|
70
68
|
- Cardinal numbers
|
|
@@ -82,6 +80,7 @@ n2words(123, {lang: 'es'}) // 'ciento veintitrés'
|
|
|
82
80
|
- `fr` (French)
|
|
83
81
|
- `fa` (Farsi)
|
|
84
82
|
- `he` (Hebrew)
|
|
83
|
+
- `hr` (Croatian)
|
|
85
84
|
- `hu` (Hungarian)
|
|
86
85
|
- `id` (Indonesian)
|
|
87
86
|
- `it` (Italian)
|
|
@@ -98,12 +97,11 @@ n2words(123, {lang: 'es'}) // 'ciento veintitrés'
|
|
|
98
97
|
- `uk` (Ukrainian)
|
|
99
98
|
- `zh` (Chinese)
|
|
100
99
|
|
|
101
|
-
|
|
102
100
|
## Contributing
|
|
103
101
|
|
|
104
|
-
You can help by adding
|
|
102
|
+
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.
|
|
105
103
|
|
|
106
|
-
All help is welcome
|
|
104
|
+
All help is welcome!
|
|
107
105
|
|
|
108
106
|
## License
|
|
109
107
|
|