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


TypeScript is_js.not類代碼示例

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


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

示例1: 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

示例2: 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

示例3: 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

示例4: isValidDate

  /**
  * Validates that the input string is a valid date formatted as "mm/dd/yyyy"
  * @param  {String}  dateString String with date to check.
  * @return {Boolean}            checked date
  * Extrated from
  * @url http://stackoverflow.com/questions/6177975/how-to-validate-date-with-format-mm-dd-yyyy-in-javascript
  */
  private isValidDate (dateString) {
    check(is.not.null(dateString), 'Date is not set')
    check(is.not.empty(dateString), 'Date is not set')
    // First check for the pattern
    if (!/^\d{1,2}\/\d{1,2}\/\d{4}$/.test(dateString)) {
      throw new Error('Invalid date string')
    }

    // Parse the date parts to integers
    const parts = dateString.split('/')
    const day = parseInt(parts[0], 10)
    const month = parseInt(parts[1], 10)
    const year = parseInt(parts[2], 10)

    // Check the ranges of month and year
    if (year < 1000 || year > 3000 || month === 0 || month > 12) {
      throw new Error('Invalid date string')
    }

    const monthLength = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]

    // Adjust for leap years
    if (year % 400 === 0 || (year % 100 !== 0 && year % 4 === 0)) {
      monthLength[1] = 29
    }

    // Check the range of the day
    return day > 0 && day <= monthLength[month - 1]
  }
開發者ID:Finciero,項目名稱:transaction-builder,代碼行數:36,代碼來源:transaction.ts

示例5: isValidKind

  private isValidKind (kind: string) {
    const noType = lodash.includes(TRANSACTION_TYPES, kind)
    check(is.not.null(kind), 'Kind is not set')
    check(is.not.empty(kind), 'Kind is not set')
    if (!noType) {
      throw new Error('Invalid transaction kind.')
    }

    if (typeof kind === 'undefined') {
      throw new Error('Kind cannot be undefined')
    }
  }
開發者ID:Finciero,項目名稱:transaction-builder,代碼行數:12,代碼來源:transaction.ts

示例6: isValidDescription

 private isValidDescription (description: string): boolean {
   check(is.not.null(description), 'Description can\'t be empty')
   check(is.not.empty(description), 'Description can\'t be empty')
   check(is.string(description), 'Description must be a string')
   return true
 };
開發者ID:Finciero,項目名稱:transaction-builder,代碼行數:6,代碼來源: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.not類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。