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


TypeScript to-boolean類代碼示例

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


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

示例1:

#!/usr/bin/env node

import './ts-paths-bootstrap'

import { AppInsights } from 'modules/app-insights'
// App Insights needs to be enabled as early as possible as it monitors other libraries as well
AppInsights.enable()

import * as config from 'config'
import * as toBoolean from 'to-boolean'

import { app } from './app'
import { ApplicationCluster } from './applicationCluster'
import { ApplicationRunner } from './applicationRunner'

if (toBoolean(config.get<boolean>('featureToggles.clusterMode'))) {
  ApplicationCluster.execute(() => ApplicationRunner.run(app))
} else {
  ApplicationRunner.run(app)
}
開發者ID:hmcts,項目名稱:cmc-citizen-frontend,代碼行數:20,代碼來源:server.ts

示例2: fromObject

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

    const declared: boolean = value.declared !== undefined ?
      toBoolean(value.declared) : undefined

    return new OtherDependants(
      declared,
      declared ? NumberOfPeople.fromObject(value.numberOfPeople) : undefined
    )
  }
開發者ID:hmcts,項目名稱:cmc-citizen-frontend,代碼行數:13,代碼來源:otherDependants.ts

示例3: it

 it('should return toggle value if testingSupport toggle exists', () => {
   const expectedToggleValue: boolean = toBoolean(config.get<boolean>(`featureToggles.testingSupport`))
   expect(FeatureToggles.isEnabled('testingSupport')).to.equal(expectedToggleValue)
 })
開發者ID:hmcts,項目名稱:cmc-citizen-frontend,代碼行數:4,代碼來源:featureToggles.ts

示例4: fromObject

 static fromObject (value?: any): Declaration {
   if (!value) {
     return value
   }
   return new Declaration(value.signed && toBoolean(value.signed))
 }
開發者ID:hmcts,項目名稱:cmc-citizen-frontend,代碼行數:6,代碼來源:declaration.ts

示例5: fromObject

 static fromObject (value?: any): SettlementAgreement {
   if (!value) {
     return value
   }
   return new SettlementAgreement(value.signed && toBoolean(value.signed))
 }
開發者ID:hmcts,項目名稱:cmc-citizen-frontend,代碼行數:6,代碼來源:settlementAgreement.ts

示例6: toBoolean

 return Object.keys(featureToggles).reduce((result: { [key: string]: boolean }, property: string) => {
   result[property] = toBoolean(Object.getOwnPropertyDescriptor(featureToggles, property).value)
   return result
 }, {})
開發者ID:hmcts,項目名稱:cmc-citizen-frontend,代碼行數:4,代碼來源:index.ts

示例7: toBoolean

 .some((featureName) => toBoolean(config.get<boolean>(`featureToggles.${featureName}`)))
開發者ID:hmcts,項目名稱:cmc-citizen-frontend,代碼行數:1,代碼來源:featureToggles.ts


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