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