本文整理汇总了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)
}
示例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
)
}
示例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)
})
示例4: fromObject
static fromObject (value?: any): Declaration {
if (!value) {
return value
}
return new Declaration(value.signed && toBoolean(value.signed))
}
示例5: fromObject
static fromObject (value?: any): SettlementAgreement {
if (!value) {
return value
}
return new SettlementAgreement(value.signed && toBoolean(value.signed))
}
示例6: toBoolean
return Object.keys(featureToggles).reduce((result: { [key: string]: boolean }, property: string) => {
result[property] = toBoolean(Object.getOwnPropertyDescriptor(featureToggles, property).value)
return result
}, {})
示例7: toBoolean
.some((featureName) => toBoolean(config.get<boolean>(`featureToggles.${featureName}`)))