本文整理汇总了TypeScript中underscore.reject函数的典型用法代码示例。如果您正苦于以下问题:TypeScript reject函数的具体用法?TypeScript reject怎么用?TypeScript reject使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了reject函数的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: getYearValues
static getYearValues(futureDates: boolean, yearsFromNow = 110, startCap = 0) {
let r = _.range(0, yearsFromNow).map(i => futureDates ? moment().add(i, 'years').year() : moment().subtract(i, 'years').year());
if (startCap) {
return futureDates ? _.reject(r, v => v < startCap) : _.reject(r, v => v > startCap);
}
return r;
}
示例2: function
removeSelection: function(){
if(this.obj.prototype.api){
this.selection().forEach(function(item){
item.remove();
});
}
this.all = _.reject(this.all, function(item){ return item.selected });
},
示例3: _getNewItems
_getNewItems(allItems: DimItem[], reviewDataCache) {
const allDtrItems = allItems.map((item) => this._itemTransformer.translateToDtrItem(item));
const allKnownDtrItems = reviewDataCache.getItemStores();
const unmatched = _.reject(allDtrItems, (dtrItem) => _.any(allKnownDtrItems, { referenceId: String(dtrItem.referenceId) }));
return unmatched;
}
示例4: instantiateToElement
instantiateToElement(object: IQueryResult, instantiateOptions: IInstantiateTemplateOptions = {}): Promise<HTMLElement> {
let merged = new DefaultInstantiateTemplateOptions().merge(instantiateOptions);
const filteredTemplates = _.reject(this.templates, t => t.role != null);
for (var i = 0; i < filteredTemplates.length; i++) {
var promiseOfHTMLElement = filteredTemplates[i].instantiateToElement(object, merged);
if (promiseOfHTMLElement != null) {
return promiseOfHTMLElement;
}
}
return this.getFallbackTemplate().instantiateToElement(object, merged);
}
示例5: instantiateToString
instantiateToString(object: IQueryResult, instantiateOptions: IInstantiateTemplateOptions = {}): string {
let merged = new DefaultInstantiateTemplateOptions().merge(instantiateOptions);
const filteredTemplates = _.reject(this.templates, t => t.role != null);
for (var i = 0; i < filteredTemplates.length; i++) {
var result = filteredTemplates[i].instantiateToString(object, merged);
if (result != null) {
return result;
}
}
return this.getFallbackTemplate().instantiateToString(object, instantiateOptions);
}
示例6: function
this.loadCredentials().then((entries) => {
// Find the entry being asked to be removed; if found, remove it, save the remaining list
let existingEntries = _.reject(entries, function(elem) {
return elem.service === service;
});
// TODO: RemoveEntries doesn't do anything with first arg. For now, do nothing to
// the api as I'm wrapping it in all its glory. Could consider later.
this._fts.RemoveEntries(undefined, existingEntries).then(() => {
deferred.resolve(undefined);
}).catch((err) => {
deferred.reject(err);
});
})
示例7: on
on(actions.closeTab, (state, action) => {
const { tab, openTabs } = state;
const closeId = action.payload.tab || tab;
const index = openTabs.indexOf(tab);
const newOpenTabs = reject(openTabs, tabId => tabId === closeId);
let newId = tab;
if (tab === closeId) {
let nextIndex = index;
if (nextIndex >= newOpenTabs.length) {
nextIndex--;
}
newId = newOpenTabs[nextIndex];
}
return {
...state,
tab: newId,
openTabs: newOpenTabs,
};
});
示例8: on
on(actions.modalClosed, (state, action) => {
const { id } = action.payload;
return reject(state, modal => modal.id === id);
});