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.
Files changed (40) hide show
  1. package/LICENSE +1 -1
  2. package/README.md +13 -29
  3. package/dist/n2words.js +1 -1
  4. package/lib/classes/{AbstractLanguage.mjs → AbstractLanguage.js} +2 -2
  5. package/lib/classes/{BaseLanguage.mjs → BaseLanguage.js} +3 -3
  6. package/lib/i18n/{AR.mjs → AR.js} +1 -1
  7. package/lib/i18n/{AZ.mjs → AZ.js} +1 -1
  8. package/lib/i18n/{CZ.mjs → CZ.js} +1 -1
  9. package/lib/i18n/{DE.mjs → DE.js} +1 -1
  10. package/lib/i18n/{DK.mjs → DK.js} +1 -1
  11. package/lib/i18n/{EN.mjs → EN.js} +1 -1
  12. package/lib/i18n/{ES.mjs → ES.js} +1 -1
  13. package/lib/i18n/{FA.mjs → FA.js} +1 -1
  14. package/lib/i18n/{FR.mjs → FR.js} +1 -1
  15. package/lib/i18n/{HE.mjs → HE.js} +1 -1
  16. package/lib/i18n/{HR.mjs → HR.js} +1 -1
  17. package/lib/i18n/{HU.mjs → HU.js} +1 -1
  18. package/lib/i18n/{ID.mjs → ID.js} +1 -1
  19. package/lib/i18n/{IT.mjs → IT.js} +1 -1
  20. package/lib/i18n/{KO.mjs → KO.js} +1 -1
  21. package/lib/i18n/{LT.mjs → LT.js} +1 -1
  22. package/lib/i18n/{LV.mjs → LV.js} +1 -1
  23. package/lib/i18n/{NL.mjs → NL.js} +1 -1
  24. package/lib/i18n/{NO.mjs → NO.js} +1 -1
  25. package/lib/i18n/{PL.mjs → PL.js} +1 -1
  26. package/lib/i18n/{PT.mjs → PT.js} +1 -1
  27. package/lib/i18n/{RU.mjs → RU.js} +1 -1
  28. package/lib/i18n/{SR.mjs → SR.js} +1 -1
  29. package/lib/i18n/{TR.mjs → TR.js} +1 -1
  30. package/lib/i18n/{UK.mjs → UK.js} +1 -1
  31. package/lib/i18n/{VI.mjs → VI.js} +1 -1
  32. package/lib/i18n/{ZH.mjs → ZH.js} +1 -1
  33. package/lib/{n2words.mjs → n2words.js} +28 -28
  34. package/package.json +44 -36
  35. package/.editorconfig +0 -13
  36. package/.eslintrc.json +0 -105
  37. package/.gitattributes +0 -5
  38. package/bench.mjs +0 -94
  39. package/examples/node.mjs +0 -10
  40. package/webpack.config.js +0 -31
package/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) 2018 Wael TELLAT
3
+ Copyright (c) 2018-2023 Wael TELLAT
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
package/README.md CHANGED
@@ -4,12 +4,11 @@
4
4
  [![Coverage Status](https://coveralls.io/repos/github/forzagreen/n2words/badge.svg?branch=master)](https://coveralls.io/github/forzagreen/n2words?branch=master)
5
5
  [![npm](https://img.shields.io/npm/v/n2words.svg)](https://npmjs.com/package/n2words)
6
6
  [![npm](https://img.shields.io/npm/dw/n2words)](https://npmjs.com/package/n2words)
7
+ [![](https://data.jsdelivr.com/v1/package/npm/n2words/badge)](https://www.jsdelivr.com/package/npm/n2words)
7
8
 
8
- n2words is a library that converts a numerical number into a written number.
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
- We have support for multiple languages (27 and growing) and our package is lightweight, modular and has no dependencies.
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
- var n2words = require('n2words')
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
- ## Features
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
- 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
-
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)