1.0.6 • Published 4 years ago

@ull-esit-pl/uninums v1.0.6

Weekly downloads
-
License
ISC
Repository
github
Last release
4 years ago

Unicode Numbers In Javascript

npm version

Instalation and use

To install:

npm install @ull-esit-pl/uninums

To use it:

> uninums = require("@ull-esit-pl/uninums")
{ normalSpaces: [Function: normalSpaces],
  normalDigits: [Function: normalDigits],
  parseUniInt: [Function: parseUniInt],
  parseUniFloat: [Function: parseUniFloat],
  sortNumeric: [Function: sortNumeric] }
> uninums.parseUniInt('६.६')
6
> uninums.parseUniFloat('६.६')
6.6
> uninums.parseUniFloat('६.६e६')
6600000
> uninums.sortNumeric(['٣ dogs','١٠ cats','٢ mice']) 
[ '٢ mice', '٣ dogs', '١٠ cats' ]
> uninums.normalDigits('٢ mice')
'2 mice'
> uninums.normalDigits('٣ dog')
'3 dog'
> uninums.normalDigits('١٠ cats')
'10 cats'
> uninums.normalDigits('٠۴६')
'046'

Blog: Unicode Numbers In Javascript

See also the blog: Unicode Numbers In Javascript Posted on December 1, 2010 by Roy Sharon

Description

Javascript supports Unicode strings, but parsing such strings to numbers is unsupported (e.g., the user enters a phone number using Chinese numerals).
uninums.js is a small utility script that implements five methods for handling non-ASCII numerals in Javascript:

For further information on how these functions are implemented see here.

Using or modifying this project is subject to the MIT License.

1.0.6

4 years ago

1.0.5

4 years ago

1.0.4

6 years ago

1.0.3

6 years ago

1.0.2

6 years ago

1.0.1

6 years ago

1.0.0

6 years ago