• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

TypeScript array.every函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了TypeScript中core/util/array.every函数的典型用法代码示例。如果您正苦于以下问题:TypeScript every函数的具体用法?TypeScript every怎么用?TypeScript every使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了every函数的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的TypeScript代码示例。

示例1: _init

  protected _init(silent: boolean): void {
    let levels: number
    let inside_padding: number
    if (every(this.factors as any, isString)) {
      levels = 1;
      [this._mapping, inside_padding] = map_one_level(this.factors as string[], this.factor_padding)
    } else if (every(this.factors as any, (x) => isArray(x) && x.length == 2 && isString(x[0]) && isString(x[1]))) {
      levels = 2;
      [this._mapping, this.tops, inside_padding] = map_two_levels(this.factors as [string, string][], this.group_padding, this.factor_padding)
    } else if (every(this.factors as any, (x) => isArray(x) && x.length == 3  && isString(x[0]) && isString(x[1]) && isString(x[2]))) {
      levels = 3;
      [this._mapping, this.tops, this.mids, inside_padding] = map_three_levels(this.factors as [string, string, string][], this.group_padding, this.subgroup_padding, this.factor_padding)
    } else
      throw new Error("???")

    let start = 0
    let end = this.factors.length + inside_padding

    if (this.range_padding_units == "percent") {
      const half_span = (end - start) * this.range_padding / 2
      start -= half_span
      end += half_span
    } else {
      start -= this.range_padding
      end += this.range_padding
    }

    this.setv({start, end, levels}, {silent})

    if (this.bounds == "auto")
      this.setv({bounds: [start, end]}, {silent: true})
  }
开发者ID:jsignell,项目名称:bokeh,代码行数:32,代码来源:factor_range.ts


示例2: compute_indices

 compute_indices(_source: DataSource): number[] | null {
   if (this.indices != null && this.indices.length >= 0) {
     if (every(this.indices, isInteger))
       return this.indices
     else {
       logger.warn(`IndexFilter ${this.id}: indices should be array of integers, defaulting to no filtering`)
       return null
     }
   } else {
     logger.warn(`IndexFilter ${this.id}: indices was not set, defaulting to no filtering`)
     return null
   }
 }
开发者ID:digitalsatori,项目名称:Bokeh,代码行数:13,代码来源:index_filter.ts


示例3: compute_indices

 compute_indices(source: ColumnarDataSource): number[] | null {
   const booleans = this.booleans
   if (booleans != null && booleans.length > 0) {
     if (every(booleans, isBoolean)) {
       if (booleans.length !== source.get_length()) {
         logger.warn(`BooleanFilter ${this.id}: length of booleans doesn't match data source`)
       }
       return range(0, booleans.length).filter((i) => booleans[i] === true)
     } else {
       logger.warn(`BooleanFilter ${this.id}: booleans should be array of booleans, defaulting to no filtering`)
       return null
     }
   } else {
     if (booleans != null && booleans.length == 0)
       logger.warn(`BooleanFilter ${this.id}: booleans is empty, defaulting to no filtering`)
     else
       logger.warn(`BooleanFilter ${this.id}: booleans was not set, defaulting to no filtering`)
     return null
   }
 }
开发者ID:digitalsatori,项目名称:Bokeh,代码行数:20,代码来源:boolean_filter.ts


示例4: switch

 const active = (() => { switch (this.model.click_policy) {
   case "none": return true
   case "hide": return every(item.renderers, r => r.visible)
   case "mute": return every(item.renderers, r => !r.muted)
 } })()
开发者ID:digitalsatori,项目名称:Bokeh,代码行数:5,代码来源:legend.ts



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
TypeScript array.findLastIndex函数代码示例发布时间:2022-05-24
下一篇:
TypeScript array.difference函数代码示例发布时间:2022-05-24
热门推荐
热门话题
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap