tanisa 1.1.0 β 1.1.2
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/CONTRIBUTING.md +66 -0
- package/README.md +14 -4
- package/package.json +6 -7
- package/src/converter.ts +2 -2
- package/src/dictionary.ts +1 -4
- package/src/index.ts +2 -1
- package/src/interface.ts +5 -0
- package/tests/converter.test.ts +1 -1
package/CONTRIBUTING.md
ADDED
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
# Welcome to Tanisa π²π¬
|
|
2
|
+
|
|
3
|
+
Hey there,
|
|
4
|
+
Thanks for stopping by!
|
|
5
|
+
Whether you're here to squash bugs, sprinkle in new features, or just correct that one typo that's been bugging you β you're awesome and we appreciate you.
|
|
6
|
+
|
|
7
|
+
This guide is your magic scroll to contributing like a pro. Please read it before opening issues or sending pull requests. It helps us help _you_ help _us_.
|
|
8
|
+
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
## π Bug Reports & π§ Feature Ideas
|
|
12
|
+
|
|
13
|
+
Found a bug? Got a genius idea at 2AM? We want to hear it!
|
|
14
|
+
Pop it into the [GitHub Issues](https://github.com/nifaliana/tanisa/issues) β but first:
|
|
15
|
+
|
|
16
|
+
Check if someone else already reported it.
|
|
17
|
+
Include:
|
|
18
|
+
|
|
19
|
+
- How to make the bug appear (step-by-step wizardry)
|
|
20
|
+
- Your Tanisa version
|
|
21
|
+
- Any tweaks you made (we donβt judge)
|
|
22
|
+
|
|
23
|
+
---
|
|
24
|
+
|
|
25
|
+
## π€ Pull Requests
|
|
26
|
+
|
|
27
|
+
Pull requests are like party invites β weβre thrilled to receive them. Before you crash the repo with your awesome code:
|
|
28
|
+
|
|
29
|
+
1. Work from the latest **main** branch.
|
|
30
|
+
2. Check if someone already fixed that issue.
|
|
31
|
+
3. For big stuff, open an issue first so we can cheer you on.
|
|
32
|
+
|
|
33
|
+
**To contribute**:
|
|
34
|
+
|
|
35
|
+
1. Fork the repo.
|
|
36
|
+
2. Make your changes β focus, grasshopper.
|
|
37
|
+
3. Pass all local tests, pre-commits and pre-push (Tanisa is picky).
|
|
38
|
+
4. Write meaningful and [conventional commit](https://www.conventionalcommits.org/en/v1.0.0/) messages (not just βfix stuffβ π
).
|
|
39
|
+
5. Open that pull request.
|
|
40
|
+
6. Watch the CI like a hawk β fix if it fails.
|
|
41
|
+
7. Stick around for feedback, high fives, or emoji reactions.
|
|
42
|
+
|
|
43
|
+
---
|
|
44
|
+
|
|
45
|
+
## π Not Sure Where to Start?
|
|
46
|
+
|
|
47
|
+
We label issues with things like `help wanted`, `bug`, `enhancement`, and `question`.
|
|
48
|
+
Check out `help wanted` for a warm welcome into the codebase!
|
|
49
|
+
|
|
50
|
+
---
|
|
51
|
+
|
|
52
|
+
## Be Kind. Code Nice.
|
|
53
|
+
|
|
54
|
+
We follow the [Contributor Covenant Code of Conduct](https://www.contributor-covenant.org/version/2/1/code_of_conduct.html).
|
|
55
|
+
Basically: Be cool, be respectful, and remember β behind every GitHub handle is a real human with feelings.
|
|
56
|
+
|
|
57
|
+
---
|
|
58
|
+
|
|
59
|
+
## βοΈ License Stuff
|
|
60
|
+
|
|
61
|
+
Check the [LICENSE](LICENSE) file for the legal spells.
|
|
62
|
+
We may ask you to confirm you're cool with our open-source terms when you contribute.
|
|
63
|
+
|
|
64
|
+
---
|
|
65
|
+
|
|
66
|
+
π Thatβs it! Now go forth, brave contributor, and may your PRs be swift and your bugs be tiny.
|
package/README.md
CHANGED
|
@@ -3,7 +3,9 @@
|
|
|
3
3
|
[](https://www.npmjs.com/package/tanisa)
|
|
4
4
|

|
|
5
5
|
|
|
6
|
-
**Tanisa**
|
|
6
|
+
**Tanisa** is here to give those digits a voice, transforming them into elegant Malagasy words π²π¬.
|
|
7
|
+
|
|
8
|
+
**In simpler terms** : An utility to convert malagasy numbers into their word representations.
|
|
7
9
|
|
|
8
10
|
## Features
|
|
9
11
|
|
|
@@ -40,6 +42,8 @@ tanisa.toWords(233)
|
|
|
40
42
|
tanisa.toWords(233) ==> Telo amby telopolo sy roanjato
|
|
41
43
|
tanisa.toWords(18.3) ==> Valo amby folo faingo telo
|
|
42
44
|
tanisa.toWords(0.008) ==> Aotra faingo aotra aotra valo
|
|
45
|
+
|
|
46
|
+
tanisa.toWords(12_345_678_901) ==> iraika amby sivinjato sy valo arivo sy fito alina sy enina hetsy sy dimy tapitrisa sy efatra safatsiroa sy telo tsitamboisa sy roa lavitrisa sy iray alinkisa
|
|
43
47
|
```
|
|
44
48
|
|
|
45
49
|
## Options
|
|
@@ -54,13 +58,19 @@ tanisa.toWords(0.008) ==> Aotra faingo aotra aotra valo
|
|
|
54
58
|
Examples:
|
|
55
59
|
|
|
56
60
|
```
|
|
57
|
-
|
|
61
|
+
tanisa.toWords("456.789", { ignoreDecimal: true }) => Enina amby dimampolo sy efajato
|
|
58
62
|
|
|
59
|
-
|
|
63
|
+
tanisa.toWords("3.14567", { decimalPlaces: 2 }); ==> Telo faingo efatra amby folo
|
|
60
64
|
|
|
61
|
-
|
|
65
|
+
tanisa.toWords("3.14567", { decimalPlaces: 2, ignoreDecimal: true }); ==> Telo
|
|
62
66
|
```
|
|
63
67
|
|
|
68
|
+
## Contribution
|
|
69
|
+
|
|
70
|
+
**Contributions are welcome!**
|
|
71
|
+
|
|
72
|
+
Feel free to check out the [CONTRIBUTING](CONTRIBUTING) file.
|
|
73
|
+
|
|
64
74
|
## License
|
|
65
75
|
|
|
66
76
|
This project is proudly released under the [MIT License](https://github.com/nifaliana/tanisa/blob/main/LICENSE)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "tanisa",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.2",
|
|
4
4
|
"main": "src/index.ts",
|
|
5
5
|
"description": "An utility to convert Malagasy π²π¬ numbers, including decimals, into their word representations.",
|
|
6
6
|
"license": "MIT",
|
|
@@ -37,16 +37,15 @@
|
|
|
37
37
|
"vitest": "^3.1.1"
|
|
38
38
|
},
|
|
39
39
|
"keywords": [
|
|
40
|
-
"
|
|
41
|
-
"
|
|
42
|
-
"words",
|
|
40
|
+
"javascript",
|
|
41
|
+
"typescript",
|
|
42
|
+
"number-to-words",
|
|
43
43
|
"converter",
|
|
44
44
|
"i18n",
|
|
45
|
-
"l10n",
|
|
46
45
|
"toWords",
|
|
47
46
|
"fanisana",
|
|
48
|
-
"
|
|
49
|
-
"
|
|
47
|
+
"malagasy",
|
|
48
|
+
"tanisa"
|
|
50
49
|
],
|
|
51
50
|
"repository": {
|
|
52
51
|
"type": "git",
|
package/src/converter.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { TanisaOptions } from './interface'
|
|
1
|
+
import { MalagasyNumerals } from './dictionary'
|
|
2
|
+
import { TanisaOptions, LargeNumberUnit } from './interface'
|
|
3
3
|
|
|
4
4
|
export class Tanisa {
|
|
5
5
|
public toWords(number: number | string, options?: TanisaOptions): string {
|
package/src/dictionary.ts
CHANGED
|
@@ -42,7 +42,7 @@ export const MalagasyNumerals = {
|
|
|
42
42
|
'telonjato',
|
|
43
43
|
'efajato',
|
|
44
44
|
'dimanjato',
|
|
45
|
-
'
|
|
45
|
+
'eninjato',
|
|
46
46
|
'fitonjato',
|
|
47
47
|
'valonjato',
|
|
48
48
|
'sivinjato',
|
|
@@ -68,6 +68,3 @@ export const MalagasyNumerals = {
|
|
|
68
68
|
|
|
69
69
|
MAX_SUPPORTED_INTEGER: 1_000_000_000_000_000_000 * 1000,
|
|
70
70
|
} as const
|
|
71
|
-
|
|
72
|
-
export type LargeNumberUnit =
|
|
73
|
-
(typeof MalagasyNumerals.LARGE_NUMBER_UNITS)[number]
|
package/src/index.ts
CHANGED
package/src/interface.ts
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { MalagasyNumerals } from './dictionary'
|
|
2
|
+
|
|
1
3
|
export interface TanisaOptions {
|
|
2
4
|
/**
|
|
3
5
|
* If true, ignores the decimal part of the number.
|
|
@@ -13,3 +15,6 @@ export interface TanisaOptions {
|
|
|
13
15
|
*/
|
|
14
16
|
decimalPlaces?: number
|
|
15
17
|
}
|
|
18
|
+
|
|
19
|
+
export type LargeNumberUnit =
|
|
20
|
+
(typeof MalagasyNumerals.LARGE_NUMBER_UNITS)[number]
|
package/tests/converter.test.ts
CHANGED
|
@@ -32,7 +32,7 @@ describe('MalagasyNumberToWords', () => {
|
|
|
32
32
|
[201, 'iraika amby roanjato'],
|
|
33
33
|
[210, 'folo sy roanjato'],
|
|
34
34
|
[225, 'dimy amby roapolo sy roanjato'],
|
|
35
|
-
[600, '
|
|
35
|
+
[600, 'eninjato'],
|
|
36
36
|
[999, 'sivy amby sivifolo sy sivinjato'],
|
|
37
37
|
// // Thousands
|
|
38
38
|
[1000, 'arivo'],
|