Comments (8)
@anglesh 内部没有加数值判断导致的错误,这个你最好在调用函数之前检测传入的参数是否都是数值
from number-precision.
@anglesh 先将不是数值的做一次转换处理或者提前禁止计算
from number-precision.
后面能加下数值判断吗,因为每次调用都要判断,有点麻烦
from number-precision.
@anglesh 这个可能不好加,因为不知道出现 undefined、null 是要转换为 0 呢还是直接报错
from number-precision.
那可以提供个参数供设置下吗,的确每次判断有点麻烦
from number-precision.
@lhwu 预期需要处理的是什么样的数据?
from number-precision.
需要的是处理 undefined 的数据,常见的是本地开发时没碰到取值为undefined的数据,但是测试/生产时,数据可能取值到了 undefined(默认做0处理就行),导致报错。
而这时候需要再去对数据进行赋默认值操作,而且用到的地方比较多,每次操作都进行这个操作的话,比较烦杂。
所以觉得如果有个设置能统一处理下这种好。
from number-precision.
同求,遇到null or undefined统一返回成NaN应该就行了吧
from number-precision.
Related Issues (20)
- times 计算问题 HOT 1
- 计算无限循环小数的问题 HOT 2
- 计算时数量级超过475左右会报栈溢出
- 参数为字符串且末尾包含空格导致计算错误 HOT 3
- 能不能像jQuery那样链式操作呢 HOT 5
- 控制台warning HOT 2
- strip 不生效 HOT 3
- 能否打包时也打包打包.d.ts啊
- Multiplication issue HOT 1
- 增加除余操作
- Missing .d.ts file in packaged output, when using tsc in host program based ts 4.x may cause problem
- add操作字符串计算错误 HOT 1
- undefined/null校验
- why do this use precision = 15 as default value for strip function? HOT 1
- 怎么默认结果是保留两位小数的字符串?
- times Calculation error HOT 1
- 希望能在运算效率上再加强 HOT 1
- 除法超出最大整型值报错
- 能增加一个最多精确到多少位小数的支持吗?
- Beyond boundary warnings
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from number-precision.