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


TypeScript each.default函数代码示例

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


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

示例1: sync

    sync(activities: TActivity[]) {
        const
            existingActivities: TActivityViewModel[] = this.list.getValue(),

            deletedActivities = __filter(
                existingActivities,
                viewModel => __every(activities, activity => this.areNotEqual(activity, viewModel))),

            addedActivities = __filter(
                activities,
                activity => __every(existingActivities, viewModel => this.areNotEqual(activity, viewModel))),

            updatedActivities = __filter(
                existingActivities,
                viewModel => __some<TActivity>(activities, activity => this.areEqual(activity, viewModel))),

            addedViewModels = __map(addedActivities, this.mapper),

            finder = (viewModel: TActivityViewModel) => __find(activities, activity => this.areEqual(activity, viewModel));

        __each(deletedActivities, viewModel => this.list.remove(viewModel));
        __each(addedViewModels, viewModel => {
            viewModel.updateFrom(finder(viewModel));
            this.list.add(viewModel);
        });
        __each(updatedActivities, viewModel => viewModel.updateFrom(finder(viewModel)));
    }
开发者ID:guryanovev,项目名称:CrystalQuartz,代码行数:27,代码来源:activities-synschronizer.ts

示例2: describe

  describe('subtraction', () => {
    let now: DateTime;
    let anchored: DateTime;

    beforeEach(() => {
      clock = sinon.useFakeTimers(unix);
      now = dateTime();
      anchored = dateTime(anchor);
    });

    each(spans, span => {
      const nowEx = 'now-5' + span;
      const thenEx = anchor + '||-5' + span;

      it('should return 5' + span + ' ago', () => {
        expect(dateMath.parse(nowEx)!.format(format)).toEqual(now.subtract(5, span).format(format));
      });

      it('should return 5' + span + ' before ' + anchor, () => {
        expect(dateMath.parse(thenEx)!.format(format)).toEqual(anchored.subtract(5, span).format(format));
      });
    });

    afterEach(() => {
      clock.restore();
    });
  });
开发者ID:grafana,项目名称:grafana,代码行数:27,代码来源:datemath.test.ts

示例3: dispose

 dispose() {
     __each(this._disposables, x => x.dispose());
 }
开发者ID:guryanovev,项目名称:CrystalQuartz,代码行数:3,代码来源:timeline-activity-view-model.ts

示例4: constructor

 constructor(translate: TranslateService) {
   each(translations, (translation, lang) => {
     translate.setTranslation(lang, translation);
   });
   translate.use("en");
 }
开发者ID:flaviait,项目名称:ng2-jspm-template,代码行数:6,代码来源:shared.module.ts

示例5: notifyStateChange

 notifyStateChange(oldState){
   each(
     this.getStatefulAccessors(),
     accessor => accessor.onStateChange(oldState)
   )
 }
开发者ID:Eric013,项目名称:searchkit,代码行数:6,代码来源:AccessorManager.ts

示例6: setState

 setState(state){
   each(
     this.getStatefulAccessors(),
     accessor=>accessor.fromQueryObject(state)
   )
 }
开发者ID:Eric013,项目名称:searchkit,代码行数:6,代码来源:AccessorManager.ts

示例7: resetState

 resetState(){
   each(this.getStatefulAccessors(), a => a.resetState())
 }
开发者ID:Eric013,项目名称:searchkit,代码行数:3,代码来源:AccessorManager.ts

示例8: setResults

 setResults(results){
   each(this.accessors, a => a.setResults(results))
 }
开发者ID:Eric013,项目名称:searchkit,代码行数:3,代码来源:AccessorManager.ts

示例9: buildQuery

 buildQuery(){
   each(this.getActiveAccessors(), accessor => accessor.beforeBuildQuery())
   return this.buildOwnQuery(
     this.buildSharedQuery(new ImmutableQuery())
   )
 }
开发者ID:Eric013,项目名称:searchkit,代码行数:6,代码来源:AccessorManager.ts


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