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


TypeScript Seq.of方法代码示例

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


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

示例1: it

 it('slices a sequence', () => {
   expect(Seq.of(1,2,3,4,5,6).slice(2).toArray()).toEqual([3,4,5,6]);
   expect(Seq.of(1,2,3,4,5,6).slice(2, 4).toArray()).toEqual([3,4]);
   expect(Seq.of(1,2,3,4,5,6).slice(-3, -1).toArray()).toEqual([4,5]);
   expect(Seq.of(1,2,3,4,5,6).slice(-1).toArray()).toEqual([6]);
   expect(Seq.of(1,2,3,4,5,6).slice(0, -1).toArray()).toEqual([1,2,3,4,5]);
 })
开发者ID:Harishs84,项目名称:immutable-js,代码行数:7,代码来源:slice.ts

示例2: it

 it('zips lists into a list of tuples', () => {
   expect(
     Seq.of(1,2,3).zip(Seq.of(4,5,6)).toArray()
   ).toEqual(
     [[1,4],[2,5],[3,6]]
   );
 });
开发者ID:AntanasBarauskas,项目名称:immutable-js,代码行数:7,代码来源:zip.ts

示例3: it

 it('concats two sequences', () => {
   var a = Seq.of(1,2,3);
   var b = Seq.of(4,5,6);
   expect(a.concat(b)).is(Seq.of(1,2,3,4,5,6))
   expect(a.concat(b).size).toBe(6);
   expect(a.concat(b).toArray()).toEqual([1,2,3,4,5,6]);
 })
开发者ID:AntanasBarauskas,项目名称:immutable-js,代码行数:7,代码来源:concat.ts

示例4: it

 it('differentiates decimals', () => {
   expect(
     Seq.of(1.5).hashCode()
   ).not.toBe(
     Seq.of(1.6).hashCode()
   );
 });
开发者ID:AntanasBarauskas,项目名称:immutable-js,代码行数:7,代码来源:Equality.ts

示例5: it

    it('lazily evaluates Seq with unknown length', () => {
      var seq = Seq.of(1,2,3,4,5,6).filter(x => x % 2 === 0);
      expect(seq.size).toBe(undefined);
      expect(seq.isEmpty()).toBe(false);
      expect(seq.size).toBe(undefined);

      var seq = Seq.of(1,2,3,4,5,6).filter(x => x > 10);
      expect(seq.size).toBe(undefined);
      expect(seq.isEmpty()).toBe(true);
      expect(seq.size).toBe(undefined);
    })
开发者ID:Harishs84,项目名称:immutable-js,代码行数:11,代码来源:count.ts

示例6: it

 it('groups indexed sequences, maintaining indicies when keyed sequences', () => {
   expect(
     Seq.of(1,2,3,4,5,6).groupBy(x => x % 2).toJS()
   ).toEqual(
     {1:[1,3,5], 0:[2,4,6]}
   );
   expect(
     Seq.of(1,2,3,4,5,6).toKeyedSeq().groupBy(x => x % 2).toJS()
   ).toEqual(
     {1:{0:1, 2:3, 4:5}, 0:{1:2, 3:4, 5:6}}
   );
 })
开发者ID:Harishs84,项目名称:immutable-js,代码行数:12,代码来源:groupBy.ts


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