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


TypeScript array.copy函数代码示例

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


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

示例1: change_input

  change_input(i: number): void {
    const active = copy(this.active)

    if (includes(active, i))
      removeBy(active, (j) => i == j)
    else
      active.push(i)

    active.sort()

    this.active = active

    if (this.callback != null)
      this.callback.execute(this)
  }
开发者ID:Zyell,项目名称:bokeh,代码行数:15,代码来源:checkbox_button_group.ts

示例2: _build_discontinuous_object

  _build_discontinuous_object(nanned_qs) {
    // _s is @xs, @ys, @sxs, @sys
    // an object of n 1-d arrays in either data or screen units
    //
    // Each 1-d array gets broken to an array of arrays split
    // on any NaNs
    //
    // So:
    // { 0: [x11, x12],
    //   1: [x21, x22, x23],
    //   2: [x31, NaN, x32]
    // }
    // becomes
    // { 0: [[x11, x12]],
    //   1: [[x21, x22, x23]],
    //   2: [[x31],[x32]]
    // }
    const ds = {};
    for (let i = 0, end = nanned_qs.length; i < end; i++) {
      ds[i] = [];
      let qs = copy(nanned_qs[i]);
      while (qs.length > 0) {

        let qs_part;
        const nan_index = findLastIndex(qs, (q) => isStrictNaN(q));

        if (nan_index >= 0) {
          qs_part = qs.splice(nan_index);
        } else {
          qs_part = qs;
          qs = [];
        }

        const denanned = qs_part.filter((q) => !isStrictNaN(q))
        ds[i].push(denanned)
      }
    }
    return ds;
  }
开发者ID:FourtekIT-incubator,项目名称:bokeh,代码行数:39,代码来源:patches.ts

示例3: _build_discontinuous_object

  private _build_discontinuous_object(nanned_qs: number[][]): number[][][] {
    // _s is this.xs, this.ys, this.sxs, this.sys
    // an object of n 1-d arrays in either data or screen units
    //
    // Each 1-d array gets broken to an array of arrays split
    // on any NaNs
    //
    // So:
    // { 0: [x11, x12],
    //   1: [x21, x22, x23],
    //   2: [x31, NaN, x32]
    // }
    // becomes
    // { 0: [[x11, x12]],
    //   1: [[x21, x22, x23]],
    //   2: [[x31],[x32]]
    // }
    const ds: number[][][] = []
    for (let i = 0, end = nanned_qs.length; i < end; i++) {
      ds[i] = []
      let qs = copy(nanned_qs[i])
      while (qs.length > 0) {
        const nan_index = findLastIndex(qs, (q) => isStrictNaN(q))

        let qs_part
        if (nan_index >= 0)
          qs_part = qs.splice(nan_index)
        else {
          qs_part = qs
          qs = []
        }

        const denanned = qs_part.filter((q) => !isStrictNaN(q))
        ds[i].push(denanned)
      }
    }
    return ds
  }
开发者ID:gully,项目名称:bokeh,代码行数:38,代码来源:patches.ts

示例4: doFormat

 doFormat(ticks: string[], _opts: {loc: number}): string[] {
   return copy(ticks)
 }
开发者ID:digitalsatori,项目名称:Bokeh,代码行数:3,代码来源:categorical_tick_formatter.ts

示例5: doFormat

 doFormat(ticks: string[], _axis: Axis): string[] {
   return copy(ticks)
 }
开发者ID:Zyell,项目名称:bokeh,代码行数:3,代码来源:categorical_tick_formatter.ts


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