n2words 1.15.0 → 1.16.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/LICENSE +1 -1
- package/README.md +13 -29
- package/dist/n2words.js +1 -1
- package/lib/classes/{AbstractLanguage.mjs → AbstractLanguage.js} +2 -2
- package/lib/classes/{BaseLanguage.mjs → BaseLanguage.js} +3 -3
- package/lib/i18n/{AR.mjs → AR.js} +1 -1
- package/lib/i18n/{AZ.mjs → AZ.js} +1 -1
- package/lib/i18n/{CZ.mjs → CZ.js} +1 -1
- package/lib/i18n/{DE.mjs → DE.js} +1 -1
- package/lib/i18n/{DK.mjs → DK.js} +1 -1
- package/lib/i18n/{EN.mjs → EN.js} +1 -1
- package/lib/i18n/{ES.mjs → ES.js} +1 -1
- package/lib/i18n/{FA.mjs → FA.js} +1 -1
- package/lib/i18n/{FR.mjs → FR.js} +1 -1
- package/lib/i18n/{HE.mjs → HE.js} +1 -1
- package/lib/i18n/{HR.mjs → HR.js} +1 -1
- package/lib/i18n/{HU.mjs → HU.js} +1 -1
- package/lib/i18n/{ID.mjs → ID.js} +1 -1
- package/lib/i18n/{IT.mjs → IT.js} +1 -1
- package/lib/i18n/{KO.mjs → KO.js} +1 -1
- package/lib/i18n/{LT.mjs → LT.js} +1 -1
- package/lib/i18n/{LV.mjs → LV.js} +1 -1
- package/lib/i18n/{NL.mjs → NL.js} +1 -1
- package/lib/i18n/{NO.mjs → NO.js} +1 -1
- package/lib/i18n/{PL.mjs → PL.js} +1 -1
- package/lib/i18n/{PT.mjs → PT.js} +1 -1
- package/lib/i18n/{RU.mjs → RU.js} +1 -1
- package/lib/i18n/{SR.mjs → SR.js} +1 -1
- package/lib/i18n/{TR.mjs → TR.js} +1 -1
- package/lib/i18n/{UK.mjs → UK.js} +1 -1
- package/lib/i18n/{VI.mjs → VI.js} +1 -1
- package/lib/i18n/{ZH.mjs → ZH.js} +1 -1
- package/lib/{n2words.mjs → n2words.js} +28 -28
- package/package.json +44 -36
- package/.editorconfig +0 -13
- package/.eslintrc.json +0 -105
- package/.gitattributes +0 -5
- package/bench.mjs +0 -94
- package/examples/node.mjs +0 -10
- package/webpack.config.js +0 -31
package/LICENSE
CHANGED
package/README.md
CHANGED
|
@@ -4,12 +4,11 @@
|
|
|
4
4
|
[](https://coveralls.io/github/forzagreen/n2words?branch=master)
|
|
5
5
|
[](https://npmjs.com/package/n2words)
|
|
6
6
|
[](https://npmjs.com/package/n2words)
|
|
7
|
+
[](https://www.jsdelivr.com/package/npm/n2words)
|
|
7
8
|
|
|
8
|
-
|
|
9
|
+
__n2words__ converts a numerical number into a written one, supports [27 languages](https://github.com/forzagreen/n2words#supported-languages), and has zero dependencies.
|
|
9
10
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
## How To
|
|
11
|
+
## Example
|
|
13
12
|
|
|
14
13
|
```js
|
|
15
14
|
n2words(123) // 'one hundred and twenty-three'
|
|
@@ -20,6 +19,8 @@ n2words(123, {lang: 'es'}) // 'ciento veintitrés'
|
|
|
20
19
|
n2words(123, {lang: 'ar'}) // 'مائة و ثلاثة و عشرون'
|
|
21
20
|
```
|
|
22
21
|
|
|
22
|
+
See the [Wiki](https://github.com/forzagreen/n2words/wiki) for examples and advanced usage.
|
|
23
|
+
|
|
23
24
|
## Install
|
|
24
25
|
|
|
25
26
|
```sh
|
|
@@ -34,42 +35,28 @@ n2words is also available on [jsDelivr](https://jsdelivr.com/package/npm/n2words
|
|
|
34
35
|
|
|
35
36
|
```js
|
|
36
37
|
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
38
|
```
|
|
44
39
|
|
|
45
40
|
### CommonJS
|
|
46
41
|
|
|
47
42
|
```js
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
// Dynamic Import (source files)
|
|
51
|
-
import('n2words/lib/n2words.mjs').then(n2words => {
|
|
43
|
+
// Dynamic Import
|
|
44
|
+
import('n2words').then(n2words => {
|
|
52
45
|
// Available via "default" method
|
|
53
46
|
n2words.default(100)
|
|
54
47
|
})
|
|
55
|
-
|
|
56
|
-
// Individual languages
|
|
57
|
-
import('n2words/lib/i18n/EN.mjs').then(n2wordsEN => {
|
|
58
|
-
n2wordsEN.default(100)
|
|
59
|
-
})
|
|
60
48
|
```
|
|
61
49
|
|
|
62
50
|
### Browser
|
|
63
51
|
|
|
64
52
|
```html
|
|
65
53
|
<script src="n2words.js"></script>
|
|
54
|
+
<script>
|
|
55
|
+
n2words(100)
|
|
56
|
+
</script>
|
|
66
57
|
```
|
|
67
58
|
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
- Cardinal numbers
|
|
71
|
-
- Decimal numbers
|
|
72
|
-
- Negative numbers
|
|
59
|
+
You can also [import only specific languages](https://github.com/forzagreen/n2words/wiki/Importing-only-specific-languages) if you don't need all of them.
|
|
73
60
|
|
|
74
61
|
## Supported Languages
|
|
75
62
|
|
|
@@ -103,10 +90,7 @@ import('n2words/lib/i18n/EN.mjs').then(n2wordsEN => {
|
|
|
103
90
|
|
|
104
91
|
## Contributing
|
|
105
92
|
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
All help is welcome!
|
|
109
|
-
|
|
93
|
+
__This library is in active development.__ We are looking to improve the design and process for language contributors as well as add more languages.
|
|
110
94
|
## License
|
|
111
95
|
|
|
112
|
-
MIT
|
|
96
|
+
[MIT](https://github.com/forzagreen/n2words/blob/master/LICENSE)
|