本文整理汇总了TypeScript中vega-util.isBoolean函数的典型用法代码示例。如果您正苦于以下问题:TypeScript isBoolean函数的具体用法?TypeScript isBoolean怎么用?TypeScript isBoolean使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了isBoolean函数的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1:
export function partLayerMixins<P extends PartsMixins<any>>(
markDef: GenericCompositeMarkDef<any> & P,
part: keyof P,
compositeMarkConfig: P,
partBaseSpec: NormalizedUnitSpec
): NormalizedUnitSpec[] {
const {clip, color, opacity} = markDef;
const mark = markDef.type;
if (markDef[part] || (markDef[part] === undefined && compositeMarkConfig[part])) {
return [
{
...partBaseSpec,
mark: {
...(compositeMarkConfig[part] as MarkConfig),
...(clip ? {clip} : {}),
...(color ? {color} : {}),
...(opacity ? {opacity} : {}),
...(isMarkDef(partBaseSpec.mark) ? partBaseSpec.mark : {type: partBaseSpec.mark}),
style: `${mark}-${part}`,
...(isBoolean(markDef[part]) ? {} : (markDef[part] as MarkConfig))
}
}
];
}
return [];
}
示例2: normalizeBin
export function normalizeBin(bin: BinParams|boolean, channel: Channel) {
if (isBoolean(bin)) {
return {maxbins: autoMaxBins(channel)};
} else if (!bin.maxbins && !bin.step) {
return {...bin, maxbins: autoMaxBins(channel)};
} else {
return bin;
}
}
示例3: binToString
export function binToString(bin: BinParams | true) {
if (isBoolean(bin)) {
bin = normalizeBin(bin, undefined);
}
return (
'bin' +
keys(bin)
.map(p => varName(`_${p}_${bin[p]}`))
.join('')
);
}
示例4: normalize
export function normalize(channelDef: ChannelDef, channel: Channel): ChannelDef<any> {
if (isString(channelDef) || isNumber(channelDef) || isBoolean(channelDef)) {
const primitiveType = isString(channelDef) ? 'string' : isNumber(channelDef) ? 'number' : 'boolean';
log.warn(log.message.primitiveChannelDef(channel, primitiveType, channelDef));
return {value: channelDef};
}
// If a fieldDef contains a field, we need type.
if (isFieldDef(channelDef)) {
return normalizeFieldDef(channelDef, channel);
} else if (hasConditionalFieldDef(channelDef)) {
return {
...channelDef,
// Need to cast as normalizeFieldDef normally return FieldDef, but here we know that it is definitely Condition<FieldDef>
condition: normalizeFieldDef(channelDef.condition, channel) as Conditional<TypedFieldDef<string>>
};
}
return channelDef;
}
示例5: isBinParams
export function isBinParams(bin: BinParams | boolean): bin is BinParams {
return bin && !isBoolean(bin);
}
示例6: binToString
export function binToString(bin: BinParams | boolean) {
if (isBoolean(bin)) {
return 'bin';
}
return 'bin' + keys(bin).map(p => varName(`_${p}_${bin[p]}`)).join('');
}