本文整理汇总了TypeScript中builder-util.addValue函数的典型用法代码示例。如果您正苦于以下问题:TypeScript addValue函数的具体用法?TypeScript addValue怎么用?TypeScript addValue使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了addValue函数的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: processTargets
function processTargets(platform: Platform, types: Array<string>) {
function commonArch(currentIfNotSpecified: boolean): Array<Arch> {
if (platform === Platform.MAC) {
return args.x64 || currentIfNotSpecified ? [Arch.x64] : []
}
const result = Array<Arch>()
if (args.x64) {
result.push(Arch.x64)
}
if (args.armv7l) {
result.push(Arch.armv7l)
}
if (args.arm64) {
result.push(Arch.arm64)
}
if (args.ia32) {
result.push(Arch.ia32)
}
return result.length === 0 && currentIfNotSpecified ? [archFromString(process.arch)] : result
}
if (args.platform != null) {
throw new InvalidConfigurationError(`--platform cannot be used if --${platform.buildConfigurationKey} is passed`)
}
if (args.arch != null) {
throw new InvalidConfigurationError(`--arch cannot be used if --${platform.buildConfigurationKey} is passed`)
}
let archToType = targets.get(platform)
if (archToType == null) {
archToType = new Map<Arch, Array<string>>()
targets.set(platform, archToType)
}
if (types.length === 0) {
const defaultTargetValue = args.dir ? [DIR_TARGET] : []
for (const arch of commonArch(args.dir === true)) {
archToType.set(arch, defaultTargetValue)
}
return
}
for (const type of types) {
const suffixPos = type.lastIndexOf(":")
if (suffixPos > 0) {
addValue(archToType, archFromString(type.substring(suffixPos + 1)), type.substring(0, suffixPos))
}
else {
for (const arch of commonArch(true)) {
addValue(archToType, arch, type)
}
}
}
}
示例2: assertThat
packager.artifactCreated(event => {
if (event.file == null) {
return
}
assertThat(event.file).isAbsolute()
addValue(artifacts, event.packager.platform, event)
})