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


TypeScript coalesce.coalesce函数代码示例

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


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

示例1: it

      it('should optimize skips', () => {
        var rs = coalesce([
          // skipIfNot(1) + skip(N) -> skipIf(+N)
          r("sknot", [], 0, 1, {mode: RecordType.SkipRecordsIfNot, fixedArgs: [2]}),
          r("sk", [], 0, 2, {mode: RecordType.SkipRecords, fixedArgs: [3]}),
          r("a", [], 0, 3),
          // skipIf(1) + skip(N) -> skipIfNot(N)
          r("skif", [], 0, 4, {mode: RecordType.SkipRecordsIf, fixedArgs: [5]}),
          r("sk", [], 0, 5, {mode: RecordType.SkipRecords, fixedArgs: [6]}),
          r("b", [], 0, 6),
          // remove empty skips
          r("sknot", [], 0, 7, {mode: RecordType.SkipRecordsIfNot, fixedArgs: [7]}),
          r("skif", [], 0, 8, {mode: RecordType.SkipRecordsIf, fixedArgs: [8]}),
          r("sk", [], 0, 9, {mode: RecordType.SkipRecords, fixedArgs: [9]}),
          r("end", [], 0, 10),
        ]);

        expect(rs).toEqual([
          r("sknot", [], 0, 1, {mode: RecordType.SkipRecordsIf, fixedArgs: [2]}),
          r("a", [], 0, 2),
          r("skif", [], 0, 3, {mode: RecordType.SkipRecordsIfNot, fixedArgs: [4]}),
          r("b", [], 0, 4),
          r("end", [], 0, 5),
        ]);
      });
开发者ID:TedSander,项目名称:angular,代码行数:25,代码来源:coalesce_spec.ts

示例2: it

 it('should preserve the argumentToPureFunction property', () => {
   var rs = coalesce([
     r('user', [], 0, 1), r('user', [], 0, 2, {argumentToPureFunction: true}),
     r('user', [], 0, 3), r('name', [], 3, 4)
   ]);
   expect(rs).toEqual(
       [r('user', [], 0, 1, {argumentToPureFunction: true}), r('name', [], 1, 2)]);
 });
开发者ID:LordBinary,项目名称:angular,代码行数:8,代码来源:coalesce_spec.ts

示例3: coalesce

       () => {
         var rs = coalesce([
           r('user1', [], 0, 1), r('user2', [], 0, 2), r('hi', [1], 0, 3), r('hi', [1], 0, 4),
           r('hi', [2], 0, 5)
         ]);

         expect(rs).toEqual(
             [r('user1', [], 0, 1), r('user2', [], 0, 2), r('hi', [1], 0, 3), r('hi', [2], 0, 4)]);
       });
开发者ID:LordBinary,项目名称:angular,代码行数:9,代码来源:coalesce_spec.ts

示例4: coalesce

 () => {
   var nullFunc = () => {};
   var rs = coalesce([
     r(nullFunc, [], 0, 1, {directiveIndex: new DirectiveIndex(0, 0)}),
     r(nullFunc, [], 0, 1, {directiveIndex: new DirectiveIndex(0, 1)}),
     r(nullFunc, [], 0, 1, {directiveIndex: new DirectiveIndex(1, 0)}),
     r(nullFunc, [], 0, 1, {directiveIndex: null}),
   ]);
   expect(rs.length).toEqual(4);
 });
开发者ID:TedSander,项目名称:angular,代码行数:10,代码来源:coalesce_spec.ts


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