convert-numbers 2.0.2
Install from the command line:
Learn more about npm packages
$ npm install @SMAKSS/convert-numbers@2.0.2
Install via package.json:
"@SMAKSS/convert-numbers": "2.0.2"
About this version
Convert Numbers is a utility package that helps ensure consistency in data transfer by converting Arabic and Persian numerals to English numerals. This is particularly useful when user inputs can come from different keyboard settings, and there's a need to standardize all digits to English format before sending data to a database or processing it further.
You can check the working demo on RunKit.
Or
To install the package, you can use npm or yarn with the following commands:
npm i @smakss/convert-numbers
# or
yarn add @smakss/convert-numbers
Import the convertNumbers
function into your project using CommonJS or ECMAScript modules:
CommonJS:
const ConvertNumbers = require('@smakss/convert-numbers');
ECMAScript Modules:
import ConvertNumbers from '@smakss/convert-numbers';
Then, use the function as follows:
// Returns '1234567890' for Persian numbers
console.log(ConvertNumbers('۱۲۳۴۵۶۷۸۹۰'));
// Returns '1234567890' for Arabic numbers
console.log(ConvertNumbers('١٢٣٤٥٦٧٨٩٠'));
// Returns "" for no input
console.log(ConvertNumbers());
For more detailed examples and function usage, please refer to the JSDoc comments within the code.
Contributions to the project are welcome! Please refer to CONTRIBUTING.md for contribution guidelines.
To maintain a welcoming and positive community, please see our Code of Conduct.
Details
- convert-numbers
-
SMAKSS
- almost 2 years ago
- MIT
- 14 dependencies
Assets
- convert-numbers-2.0.2.tgz
Download activity
- Total downloads 0
- Last 30 days 0
- Last week 0
- Today 0