Git Product home page Git Product logo

Comments (8)

lxfriday avatar lxfriday commented on June 14, 2024

@anglesh 内部没有加数值判断导致的错误,这个你最好在调用函数之前检测传入的参数是否都是数值

from number-precision.

lxfriday avatar lxfriday commented on June 14, 2024

@anglesh 先将不是数值的做一次转换处理或者提前禁止计算

from number-precision.

anglesh avatar anglesh commented on June 14, 2024

后面能加下数值判断吗,因为每次调用都要判断,有点麻烦

from number-precision.

lxfriday avatar lxfriday commented on June 14, 2024

@anglesh 这个可能不好加,因为不知道出现 undefined、null 是要转换为 0 呢还是直接报错

from number-precision.

lhwu avatar lhwu commented on June 14, 2024

那可以提供个参数供设置下吗,的确每次判断有点麻烦

from number-precision.

lxfriday avatar lxfriday commented on June 14, 2024

@lhwu 预期需要处理的是什么样的数据?

from number-precision.

lhwu avatar lhwu commented on June 14, 2024

需要的是处理 undefined 的数据,常见的是本地开发时没碰到取值为undefined的数据,但是测试/生产时,数据可能取值到了 undefined(默认做0处理就行),导致报错。

而这时候需要再去对数据进行赋默认值操作,而且用到的地方比较多,每次操作都进行这个操作的话,比较烦杂。

所以觉得如果有个设置能统一处理下这种好。

from number-precision.

xiaoqingb avatar xiaoqingb commented on June 14, 2024

同求,遇到null or undefined统一返回成NaN应该就行了吧

from number-precision.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.