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


TypeScript List.toJS方法代码示例

本文整理汇总了TypeScript中Immutable.List.toJS方法的典型用法代码示例。如果您正苦于以下问题:TypeScript List.toJS方法的具体用法?TypeScript List.toJS怎么用?TypeScript List.toJS使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Immutable.List的用法示例。


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

示例1: searchAnnotations

function searchAnnotations(search: string|null, annotations: List<Record<AnnotationColorMap>>) {
  if(search !== null) {
    const jsAnnotations = annotations.toJS()
    const fuse = new Fuse(jsAnnotations, _FUSE_OPTIONS_)
    const res: string[] = fuse.search(search)
    return annotations.filter(ann => {
      const aId = ann.getIn(['annotation', 'id'])
      return res.find(id => parseInt(id) === aId)
    })
  } else {
    return annotations
  }
}
开发者ID:StudioProcess,项目名称:rvp,代码行数:13,代码来源:index.ts

示例2: process

  /**
   * Function that intented to be used by the table plugin manager to
   * perform the sorting process. It supports sorting with mutiple sorter,
   * which will be performed in ASC order.
   *
   * NOTE: the sorting process will short circuit on any non-zero sorter
   *       result.
   */
  process(tableData: TableData, columns: List<ColumnDef>) {
    const columnSorters: Iterable<number, TableSorter> = columns
      .filterNot(s => _.isUndefined(s.sortable))
      .map(columnDef => {
        const sorter     = columnDef.sortable
        const selector   = columnDef.field
        const type       = columnDef.type
        const order      = sorter.order
        const comparator = sorter.comparator || this.getComparator(type)

        return { order, selector, comparator }
      })

    const sorters = this.sorters.concat(columnSorters)
      .filter(s => this.getSortOrder(s.order) !== NONE)

    if (sorters.size > 1 && !this.multiSortable) {
      if (process.env.NODE_ENV === 'development') {
        throw new Error(`[RCBOX] Found multiple sorter enabled while this` +
          `feature is disabled. To enable this feature, set 'multiSortable' ` +
          `property to 'true' on TableSortPlugin. Those unexpected sorters ` +
          `are: ${sorters.toJS()}`)
      }
      // NOTE: Returns unsorted table data as fallback to avoid uncertain
      //       data will be used in production environment.
      return tableData
    }

    const sorted = tableData.sort((row1, row2) => {
      const reducer = (result: number, sorter: TableSorter) => {
        const { selector, comparator } = sorter
        const order = this.getSortOrder(sorter.order)
        const factor = order === DESC ? -1 : 1

        return result !== 0
          ? result
          : comparator(selector(row1), selector(row2)) * factor
      }
      return sorters.reduce(reducer, 0)
    })

    return sorted
  }
开发者ID:zhenwenc,项目名称:rc-box,代码行数:51,代码来源:SortingPluginImpl.ts

示例3: h

 (tagName: string,
  options: VirtualDOM.createProperties,
  children: List<VirtualDOM.VNode>): VirtualDOM.VNode => (
     h(tagName, options, children.toJS())
 );
开发者ID:katebee,项目名称:frontend,代码行数:5,代码来源:render.ts


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