当前位置: 首页>>代码示例>>TypeScript>>正文


TypeScript vega-util.isBoolean函数代码示例

本文整理汇总了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 [];
}
开发者ID:vega,项目名称:vega-lite,代码行数:28,代码来源:common.ts

示例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;
  }
}
开发者ID:troystribling,项目名称:dotfiles,代码行数:9,代码来源:fielddef.ts

示例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('')
  );
}
开发者ID:vega,项目名称:vega-lite,代码行数:11,代码来源:bin.ts

示例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;
}
开发者ID:vega,项目名称:vega-lite,代码行数:19,代码来源:channeldef.ts

示例5: isBinParams

export function isBinParams(bin: BinParams | boolean): bin is BinParams {
  return bin && !isBoolean(bin);
}
开发者ID:troystribling,项目名称:dotfiles,代码行数:3,代码来源:bin.ts

示例6: binToString

export function binToString(bin: BinParams | boolean) {
  if (isBoolean(bin)) {
    return 'bin';
  }
  return 'bin' + keys(bin).map(p => varName(`_${p}_${bin[p]}`)).join('');
}
开发者ID:troystribling,项目名称:dotfiles,代码行数:6,代码来源:bin.ts


注:本文中的vega-util.isBoolean函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。