Skip to content

Commit

Permalink
Dual package functionality got added
Browse files Browse the repository at this point in the history
  • Loading branch information
SMAKSS committed May 4, 2020
1 parent 839c7a1 commit 02ce8a2
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 6 deletions.
5 changes: 3 additions & 2 deletions Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ Due to keeping consistency in our data transfer with API's we need to make sure

To install it you can simply do the following command:

```
```
npm i @smakss/convert-numbers
or
yarn add @smakss/convert-numbers
Expand All @@ -27,6 +27,7 @@ import ConvertNumbers from '@smakss/convert-numbers'
```

then to use it within your application you can do it just like this:

```
ConvertNumbers('۱۲۳۴۵۶۷۸۹۰') // It will return 1234567890 in string format.
```
```
10 changes: 10 additions & 0 deletions index.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
'use strict'
module.exports = function ConvertNumbers(inputValue) {
return inputValue
.replace(/[\u0660-\u0669]/g, function (number) {
return number.charCodeAt(0) - 1632
})
.replace(/[\u06F0-\u06F9]/g, function (number) {
return number.charCodeAt(0) - 1776
})
}
1 change: 0 additions & 1 deletion index.min.js

This file was deleted.

3 changes: 3 additions & 0 deletions index.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
'use strict'
import ConvertNumbers from './index.cjs'
export default ConvertNumbers
13 changes: 10 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,13 +1,20 @@
{
"name": "@smakss/convert-numbers",
"version": "1.0.5",
"version": "1.0.6",
"description": "This package exists to convert Arabic and Persian numbers to their English equivalent to avoiding data inconsistency.",
"main": "index.min.js",
"type": "module",
"main": "./index.cjs",
"exports": {
"import": "./index.mjs",
"require": "./index.cjs"
},
"repository": {
"type": "git",
"url": "git+https://github.com/SMAliKSS/convert-numbers.git"
},
"keywords": [
"ES5",
"ES6",
"npm",
"yarn",
"digit",
Expand All @@ -26,4 +33,4 @@
"url": "https://github.com/SMAliKSS/convert-numbers/issues"
},
"homepage": "https://github.com/SMAliKSS/convert-numbers#readme"
}
}

0 comments on commit 02ce8a2

Please sign in to comment.