Skip to content

Commit

Permalink
$Refactor base import name
Browse files Browse the repository at this point in the history
  • Loading branch information
shemmjunior committed May 22, 2021
1 parent ede470c commit 5db581b
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 17 deletions.
11 changes: 4 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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:
Expand All @@ -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



Expand Down
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -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": {
Expand All @@ -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"
Expand Down
8 changes: 4 additions & 4 deletions src/index.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
function toswahili(n) {
function toSwahili(n) {

var numerals = [
{ value: 1000000000000000000000, str: "sextillion" },
Expand Down Expand Up @@ -40,7 +40,7 @@
];

if (n < 0) {
return "hasi " + toswahili(-n);
return "hasi " + toSwahili(-n);
} else if (n === 0) {
return "sifuri";
} else {
Expand All @@ -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 ";
}
Expand All @@ -63,4 +63,4 @@
}
}

module.exports = toswahili;
module.exports = toSwahili;
6 changes: 3 additions & 3 deletions test/converter.js
Original file line number Diff line number Diff line change
@@ -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
Expand Down

0 comments on commit 5db581b

Please sign in to comment.