当前位置: 首页>>代码示例>>TypeScript>>正文


TypeScript js.default.greaterThan方法代码示例

本文整理汇总了TypeScript中bignumber.js.default.greaterThan方法的典型用法代码示例。如果您正苦于以下问题:TypeScript js.default.greaterThan方法的具体用法?TypeScript js.default.greaterThan怎么用?TypeScript js.default.greaterThan使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在bignumber.js.default的用法示例。


在下文中一共展示了js.default.greaterThan方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。

示例1: it

 it('should fetch an enterprise eth fee balance', co(function *() {
   const enterprises = bitgo.coin('teth').enterprises();
   const enterprise = (yield enterprises.list())[0];
   const feeBalance = yield enterprise.getFeeAddressBalance();
   feeBalance.should.have.property('balance');
   const balance = new BigNumber(feeBalance.balance);
   balance.greaterThan(1000).should.equal(true);
 }));
开发者ID:BitGo,项目名称:BitGoJS,代码行数:8,代码来源:enterprise.ts

示例2: prepareFee

  function prepareFee(): Promise<TransactionJSON> {
    // instructions.fee is scaled (for multi-signed transactions) while txJSON.Fee is not.
    // Due to this difference, we do NOT allow both to be set, as the behavior would be complex and
    // potentially ambiguous.
    // Furthermore, txJSON.Fee is in drops while instructions.fee is in XRP, which would just add to
    // the confusion. It is simpler to require that only one is used.
    if (txJSON.Fee && instructions.fee) {
      return Promise.reject(new ValidationError('`Fee` in txJSON and `fee` in `instructions` cannot both be set'))
    }
    if (txJSON.Fee) {
      // txJSON.Fee is set. Use this value and do not scale it.
      return Promise.resolve(txJSON)
    }
    const multiplier = instructions.signersCount === undefined ? 1 :
      instructions.signersCount + 1
    if (instructions.fee !== undefined) {
      const fee = new BigNumber(instructions.fee)
      if (fee.greaterThan(api._maxFeeXRP)) {
        return Promise.reject(new ValidationError(`Fee of ${fee.toString(10)} XRP exceeds ` +
          `max of ${api._maxFeeXRP} XRP. To use this fee, increase ` +
          '`maxFeeXRP` in the RippleAPI constructor.'))
      }
      txJSON.Fee = scaleValue(common.xrpToDrops(instructions.fee), multiplier)
      return Promise.resolve(txJSON)
    }
    const cushion = api._feeCushion
    return api.getFee(cushion).then(fee => {
      return api.connection.getFeeRef().then(feeRef => {
        const extraFee =
          (txJSON.TransactionType !== 'EscrowFinish' ||
            txJSON.Fulfillment === undefined) ? 0 :
            (cushion * feeRef * (32 + Math.floor(
              Buffer.from(txJSON.Fulfillment, 'hex').length / 16)))
        const feeDrops = common.xrpToDrops(fee)
        const maxFeeXRP = instructions.maxFee ?
          BigNumber.min(api._maxFeeXRP, instructions.maxFee) : api._maxFeeXRP
        const maxFeeDrops = common.xrpToDrops(maxFeeXRP)
        const normalFee = scaleValue(feeDrops, multiplier, extraFee)
        txJSON.Fee = BigNumber.min(normalFee, maxFeeDrops).toString(10)

        return txJSON
      })
    })
  }
开发者ID:ripple,项目名称:ripple-lib,代码行数:44,代码来源:utils.ts

示例3: BigNumber

    const y = new BigNumber(NaN)
    y.equals(NaN)                   // false
}

{
    const x = new BigNumber(1.8)
    x.floor()                       // '1'
    const y = new BigNumber(-1.3)
    y.floor()                       // '-2'
}

{
    0.1 > (0.3 - 0.2)                           // true
    const x = new BigNumber(0.1)
    x.greaterThan(new BigNumber(0.3).minus(0.2))    // false
    new BigNumber(0).gt(x)                          // false
    new BigNumber(11, 3).gt(11.1, 2);                // true
}

{
    (0.3 - 0.2) >= 0.1                   // false
    const x = new BigNumber(0.3).minus(0.2)
    x.greaterThanOrEqualTo(0.1)          // true
    new BigNumber(1).gte(x)                  // true
    new BigNumber(10, 18).gte('i', 36)       // true
}

{
    const x = new BigNumber(1)
    x.isFinite()                    // true
开发者ID:felixfbecker,项目名称:typed-bignumber.js,代码行数:30,代码来源:test.ts


注:本文中的bignumber.js.default.greaterThan方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。