number-display
Advanced tools
Comparing version 2.2.2 to 2.2.3
@@ -99,1 +99,7 @@ ## 1.0.0 | ||
- Fix config params to be optional in index.d.ts. | ||
## 2.2.3 | ||
**2020-01-08** | ||
- `allowText` default to false, to prevent unexpected result of input `''`. |
@@ -7,3 +7,3 @@ /** | ||
* @param placeholder - (Default '') Result when neither number nor text. | ||
* @param allowText - (Default true) Allow text as results, if false text will convert to placeholder, text will be slice within length param. | ||
* @param allowText - (Default false) Allow text as results, if false text will convert to placeholder, text will be slice within length param. | ||
* @param separator - (Default true) Show commas between digits in group of 3, if there are rooms. | ||
@@ -10,0 +10,0 @@ * @param roundingType - (Derault 'round') Rounding type of decimals, enum in 'round', 'floor' or 'ceil'. |
@@ -20,3 +20,3 @@ const maxPrecision = 12; | ||
* @param {string} [placeholder] result when neither number nor text; default '' | ||
* @param {boolean} [allowText] allow text as results, if false text will convert to placeholder, text will be slice within length param; default true | ||
* @param {boolean} [allowText] allow text as results, if false text will convert to placeholder, text will be slice within length param; default false | ||
* @param {boolean} [separator] show commas between digits in group of 3, if there are rooms; default true | ||
@@ -29,3 +29,3 @@ * @param {string} [roundingType] Rounding type of decimals, enum in 'round', 'floor' or 'ceil'; default 'round' | ||
placeholder = '', | ||
allowText = true, | ||
allowText = false, | ||
separator = true, | ||
@@ -32,0 +32,0 @@ roundingType = 'round', |
{ | ||
"name": "number-display", | ||
"version": "2.2.2", | ||
"version": "2.2.3", | ||
"description": "Display number smartly within a certain length.", | ||
@@ -32,3 +32,3 @@ "main": "lib/index.js", | ||
"devDependencies": { | ||
"jest": "^24.8.0" | ||
"jest": "^24.9.0" | ||
}, | ||
@@ -35,0 +35,0 @@ "jest": { |
@@ -0,2 +1,5 @@ | ||
[中文](https://github.com/entronad/number-display/blob/master/README_CN.md) | ||
# number-display | ||
*Display number smartly within a certain length.* | ||
@@ -17,3 +20,3 @@ | ||
- convert scientific notation ( 1.23e+4 ) to friendly form | ||
- directly return input text if ( configurable ) | ||
- directly return input text if allowed ( configurable ) | ||
- when omitting decimals, you can change the rounding type, default to 'round' | ||
@@ -23,2 +26,4 @@ - no decimal tailing zeros | ||
It also has a [Dart version](https://github.com/entronad/number_display) . | ||
## Install | ||
@@ -65,4 +70,2 @@ | ||
'abcdefghijklmn' => 'abcdefghi' | ||
-123456789.123456789 => '-123.457M' | ||
@@ -90,3 +93,3 @@ '123456' => '123,456' | ||
null => '--' | ||
'abcdefghijklmn' => '--' | ||
'abcdefghijklmn' => 'abcdefghi' | ||
123456 => '123456' | ||
@@ -117,3 +120,3 @@ ``` | ||
( default: true ) | ||
( default: false ) | ||
@@ -120,0 +123,0 @@ Allow *Text* ( String that cant convert to number) as input and result. It will be sliced within length param. If false , result of text will be placeholder. Note that some special form will be regarded as text like 'NaN', '-1.2345e+5'. |
11649
136