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


TypeScript numericUtils.toNumberOrUndefined函數代碼示例

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


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

示例1: fromObject

  static fromObject (value?: any): HowMuchDoYouOwe {
    if (!value) {
      return value
    }

    const amount = toNumberOrUndefined(value.amount)
    const totalAmount = toNumberOrUndefined(value.totalAmount)

    return new HowMuchDoYouOwe(amount, totalAmount)
  }
開發者ID:hmcts,項目名稱:cmc-citizen-frontend,代碼行數:10,代碼來源:howMuchDoYouOwe.ts

示例2: fromObject

  static fromObject (value?: any): NumberOfChildren {
    if (!value) {
      return value
    }

    return new NumberOfChildren(
      toNumberOrUndefined(value.under11),
      toNumberOrUndefined(value.between11and15),
      toNumberOrUndefined(value.between16and19)
    )
  }
開發者ID:hmcts,項目名稱:cmc-citizen-frontend,代碼行數:11,代碼來源:numberOfChildren.ts

示例3: deserialize

 deserialize (input?: any): OtherWitnesses {
   if (input) {
     this.otherWitnesses = YesNoOption.fromObject(input.otherWitnesses)
     if (input.otherWitnesses) {
       this.howMany = toNumberOrUndefined(input.howMany)
     }
   }
   return this
 }
開發者ID:hmcts,項目名稱:cmc-citizen-frontend,代碼行數:9,代碼來源:otherWitnesses.ts

示例4: fromObject

  static fromObject (value?: any): OtherWitnesses {
    if (!value) {
      return value
    }

    return new OtherWitnesses(
      YesNoOption.fromObject(value.otherWitnesses),
      toNumberOrUndefined(value.howMany))
  }
開發者ID:hmcts,項目名稱:cmc-citizen-frontend,代碼行數:9,代碼來源:otherWitnesses.ts

示例5: fromObject

 static fromObject (value?: any): HowMuchOwed {
   if (value) {
     const amount = toNumberOrUndefined(value.amount)
     const text = value.text
     return new HowMuchOwed(amount, text)
   } else {
     return new HowMuchOwed()
   }
 }
開發者ID:hmcts,項目名稱:cmc-citizen-frontend,代碼行數:9,代碼來源:howMuchOwed.ts

示例6: deserialize

 public deserialize (input: any): CountyCourtJudgment {
   if (input) {
     if (input.defendantDateOfBirth) {
       this.defendantDateOfBirth = MomentFactory.parse(input.defendantDateOfBirth)
     }
     this.paymentOption = input.paymentOption
     this.paidAmount = toNumberOrUndefined(input.paidAmount)
     this.repaymentPlan = input.repaymentPlan ? new RepaymentPlan().deserialize(input.repaymentPlan) : undefined
     this.payBySetDate = input.payBySetDate ? MomentFactory.parse(input.payBySetDate) : undefined
     this.statementOfTruth = new StatementOfTruth().deserialize(input.statementOfTruth)
     if (input.ccjType) {
       this.ccjType = input.ccjType
     }
   }
   return this
 }
開發者ID:hmcts,項目名稱:cmc-citizen-frontend,代碼行數:16,代碼來源:countyCourtJudgment.ts

示例7: it

 it('given "1,110,100" ', () => {
   expect(toNumberOrUndefined('1,110,100')).to.be.eq(1110100)
 })
開發者ID:hmcts,項目名稱:cmc-citizen-frontend,代碼行數:3,代碼來源:numericUtils.ts


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