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