RPA JS 扩展开发文档

RPA JS 扩展开发文档

  • SDK接口说明
  • 代码示例

xsy-breeze-ui-rpa > BigNumber > DEBUG

BigNumber.DEBUG property

To aid in debugging, if a DEBUG property is true then an error will be thrown if the BigNumber constructor receives an invalid Value, or if isBigNumber receives a BigNumber instance that is malformed.

// No error, and BigNumber NaN is returned.
new BigNumber('blurgh')    // 'NaN'
new BigNumber(9, 2)        // 'NaN'
DEBUG = true
new BigNumber('blurgh')    // '[BigNumber Error] Not a number'
new BigNumber(9, 2)        // '[BigNumber Error] Not a base 2 number'

An error will also be thrown if a Value is of type number with more than 15 significant digits, as calling toString or valueOf on such numbers may not result in the intended value.

console.log(823456789123456.3)       //  823456789123456.2
// No error, and the returned BigNumber does not have the same value as the number literal.
new BigNumber(823456789123456.3)     // '823456789123456.2'
DEBUG = true
new BigNumber(823456789123456.3)
// '[BigNumber Error] Number primitive has more than 15 significant digits'

Check that a BigNumber instance is well-formed:

x = new BigNumber(10)

DEBUG = false
// Change x.c to an illegitimate value.
x.c = NaN
// No error, as DEBUG is false.
isBigNumber(x)    // true

DEBUG = true
isBigNumber(x)    // '[BigNumber Error] Invalid BigNumber'

Signature:

static DEBUG?: boolean;
Last updated on 12/16/2020
  • BigNumber.DEBUG property
Copyright © 2021 销售易