本文整理汇总了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)));
}
示例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();
});
});
示例3: dispose
dispose() {
__each(this._disposables, x => x.dispose());
}
示例4: constructor
constructor(translate: TranslateService) {
each(translations, (translation, lang) => {
translate.setTranslation(lang, translation);
});
translate.use("en");
}
示例5: notifyStateChange
notifyStateChange(oldState){
each(
this.getStatefulAccessors(),
accessor => accessor.onStateChange(oldState)
)
}
示例6: setState
setState(state){
each(
this.getStatefulAccessors(),
accessor=>accessor.fromQueryObject(state)
)
}
示例7: resetState
resetState(){
each(this.getStatefulAccessors(), a => a.resetState())
}
示例8: setResults
setResults(results){
each(this.accessors, a => a.setResults(results))
}
示例9: buildQuery
buildQuery(){
each(this.getActiveAccessors(), accessor => accessor.beforeBuildQuery())
return this.buildOwnQuery(
this.buildSharedQuery(new ImmutableQuery())
)
}