當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。