chinese-numbers-converter
Advanced tools
Comparing version 2.0.4 to 2.0.5
{ | ||
"name": "chinese-numbers-converter", | ||
"version": "2.0.4", | ||
"version": "2.0.5", | ||
"description": "Converts Chinese numerals in a string into Arabic numerals.", | ||
@@ -5,0 +5,0 @@ "main": "chinese-numbers.js", |
@@ -14,3 +14,3 @@ # chinese-numbers-converter.js | ||
- `toInteger()` - converts a Chinese or mixed number into Arabic and returns a JavaScript `Number` type. | ||
- `toArabicString()` - translates the entire string (possibly with multiple numbers in it) and returns the same string, but with Arabic numbers. | ||
- `toArabicString(minChars)` - translates the entire string (possibly with multiple numbers in it) and returns the same string, but with Arabic numbers. The optional parameter `minChars` is the minimum number of characters that will be translated. For example, you can set it to `2` to avoid translating `九龍` into `9龍`. | ||
- `isNumberOrSpace()` - checks whether the character is part of a number (`true`) or unrelated text (`false`). | ||
@@ -31,3 +31,4 @@ | ||
```js | ||
new ChineseNumber(' 二百 or 兩百').toInteger(); // 400 - do not try to parse multiple numbers at once | ||
new ChineseNumber(' 二百 or 兩百').toInteger(); // 400 - the toInteger() method only parses one number at once. Use toArabicString() instead. | ||
new ChineseNumber('九龍').toArabicString(); // 9龍 - use the minChars parameter to avoid this | ||
``` | ||
@@ -39,7 +40,1 @@ | ||
- NPM package - `chinese-numbers-converter` | ||
## License and contributing ## | ||
Unlicense / Public domain. You can do everything. | ||
Pull requests and bug reports are welcome. |
20267
38