當前位置: 首頁>>代碼示例>>TypeScript>>正文


TypeScript is_js.number函數代碼示例

本文整理匯總了TypeScript中is_js.number函數的典型用法代碼示例。如果您正苦於以下問題:TypeScript number函數的具體用法?TypeScript number怎麽用?TypeScript number使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。


在下文中一共展示了number函數的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。

示例1: sub

 /** subtract two numbers
  * @param  {number} param1
  * @param  {number} param2
  * @returns number
  */
 static sub(param1: number, param2: number): number {
     if ((param1) && (is.number(param1) && (param2) && (is.number(param2)))) {
         return param1 - param2;
     } else {
         throw new Error("mathHelper - sub - empty or non numbers specified");
     }
 }
開發者ID:igisur,項目名稱:webtlak09tsdemo,代碼行數:12,代碼來源:mathHelper.ts

示例2: isValidUsd

 private isValidUsd (usd: string | number) {
   check(is.not.null(usd), 'USD is not set')
   check(is.not.empty(usd), 'USD is not set')
   check(is.number(Number(usd)), 'USD is not a valid number')
   check(is.above(Number(usd), -1), 'USD must be a positive number')
   return true
 }
開發者ID:Finciero,項目名稱:transaction-builder,代碼行數:7,代碼來源:transaction.ts

示例3: isValidDeposit

 private isValidDeposit (deposit: string | number) {
   check(is.not.null(deposit), 'Deposit is not set')
   check(is.not.empty(deposit), 'Deposit is not set')
   check(is.number(Number(deposit)), 'Deposit is not a valid number')
   check(is.above(Number(deposit), -1), 'Deposit must be a positive number')
   return true
 }
開發者ID:Finciero,項目名稱:transaction-builder,代碼行數:7,代碼來源:transaction.ts

示例4: isValidCharge

 private isValidCharge  (charge: string | number) {
   check(is.not.null(charge), 'Charge is not set')
   check(is.not.empty(charge), 'Charge is not set')
   check(is.number(Number(charge)), `Charge is not a valid number: ${charge}`)
   check(is.above(Number(charge), -1), 'Charge must be a positive number')
   return true
 }
開發者ID:Finciero,項目名稱:transaction-builder,代碼行數:7,代碼來源:transaction.ts

示例5: checkDues

  private checkDues (currentDue, totalDues) {
    check(is.number(Number(currentDue)), 'Current due is not a number')
    check(is.number(Number(totalDues)), 'Total dues is not a number')
    currentDue = parseInt(currentDue, 10)
    totalDues = parseInt(totalDues, 10)

    // Validations
    if (currentDue > totalDues || currentDue < 1) {
      throw new Error('Current dues can\'t be bigger than total dues or smaller than 1')
    }

    if (totalDues < 0) {
      throw new Error('Total dues can\'t be smaller than 1')
    }

    return true
  }
開發者ID:Finciero,項目名稱:transaction-builder,代碼行數:17,代碼來源:transaction.ts

示例6: isValidInterestRate

 private isValidInterestRate (interestRate: number): boolean {
   check(is.number(interestRate), 'Interest rate must be a number')
   check(is.above(interestRate, -1), 'Interest rate must be a positive number')
   return true
 }
開發者ID:Finciero,項目名稱:transaction-builder,代碼行數:5,代碼來源:transaction.ts

示例7: isValidBalance

 private isValidBalance (balance: number | string) {
   check(is.not.null(balance), 'Balance is not set')
   check(is.not.empty(balance), 'Balance is not set')
   check(is.number(Number(balance)), 'Balance is not a valid number')
   return true
 }
開發者ID:Finciero,項目名稱:transaction-builder,代碼行數:6,代碼來源:transaction.ts


注:本文中的is_js.number函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。