diff --git a/README.md b/README.md index e3521ac..0b975ed 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,7 @@ # Digits to Swahili -A Node package to convert digits to swahili words +A Node package to convert digits to swahili words based on Standard commonjs ### Installation @@ -12,8 +12,8 @@ A Node package to convert digits to swahili words #### Usage ```js -const toswahili = require('digits-to-swahili') -toswahili(500) // The output is: Mia tano +const toSwahili = require('digits-to-swahili') +toSwahili(500) // The output is: Mia tano ``` #### For Usage in React, Angular and Vue use: @@ -33,17 +33,14 @@ Test is done using mocha.js and here are the steps to run tests 4. Now run `npm run test` -#### For Issues - -Contact: juniorshemm@gmail.com or raise an issue in the repo +#### For Issues Also Feel free to contribute by creating a PR into the repository #### Licence The MIT License (MIT) -Copyright (c) 2021 - Shemm Junior diff --git a/package.json b/package.json index 0b00133..2f9c43d 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "digits-to-swahili", - "version": "1.0.7", + "version": "1.1.0", "description": "This package converts numbers into Kiswahili words", "main": "src/index.js", "scripts": { @@ -12,9 +12,9 @@ "swahili", "convert" ], - "author": "ninjametro", + "author": "shemmjunior", "license": "MIT", - "homepage": "https://github.com/ninjaMetro/digits-to-swahili", + "homepage": "https://github.com/shemmjunior/digits-to-swahili", "devDependencies": { "chai": "^4.2.0", "mocha": "^8.2.1" diff --git a/src/index.js b/src/index.js index e62e06c..5e84ebb 100644 --- a/src/index.js +++ b/src/index.js @@ -1,4 +1,4 @@ - function toswahili(n) { + function toSwahili(n) { var numerals = [ { value: 1000000000000000000000, str: "sextillion" }, @@ -40,7 +40,7 @@ ]; if (n < 0) { - return "hasi " + toswahili(-n); + return "hasi " + toSwahili(-n); } else if (n === 0) { return "sifuri"; } else { @@ -53,7 +53,7 @@ if (n > 0) result += " na "; } else { let times = Math.floor(n / numeral.value); - result += numeral.str + " " + toswahili(times); + result += numeral.str + " " + toSwahili(times); n -= numeral.value * times; if (n > 0) result += " na "; } @@ -63,4 +63,4 @@ } } -module.exports = toswahili; \ No newline at end of file +module.exports = toSwahili; \ No newline at end of file diff --git a/test/converter.js b/test/converter.js index bb13b21..6d3ce8b 100644 --- a/test/converter.js +++ b/test/converter.js @@ -1,8 +1,8 @@ -const toswahili = require('./../src/index'); +const toSwahili = require('./../src/index'); /** Test Parameters */ -const result1 = toswahili(44); -const result2 = toswahili(110000); +const result1 = toSwahili(44); +const result2 = toSwahili(110000); /** Expected Output */ var expect = require('chai').expect