本文整理汇总了TypeScript中underscore.omit函数的典型用法代码示例。如果您正苦于以下问题:TypeScript omit函数的具体用法?TypeScript omit怎么用?TypeScript omit使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了omit函数的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: function
static respondToResourceGET<T>(requestBody, res, dao: DAO<T>, whereArray: string[], likeArray: string[]) {
let whereQuery = _.omit(_.pick(requestBody, whereArray),
function (value, key, object) {
return value === "";
});
let likeQuery_ = _.chain(requestBody)
.pick(requestBody, likeArray)
.omit(function (value, key, object) {
return value === "";
}).value();
let likeQuery = _.mapObject(likeQuery_, function (value, key) {
return "%" + value + "%";
});
dao.find({
where: whereQuery, like: likeQuery, orderBy: requestBody.orderBy
}, function (err, results) {
if (err) {
APIHelper.sendDatabaseErrorResponse(res, err);
} else {
if (results.length === 0) {
APIHelper.sendNotFoundResponse(res, "Not found.");
} else {
APIHelper.sendResponse(res, results);
}
}
});
}
示例2: String
var action = String(function (args) {
var gm = require("@arangodb/general-graph");
var graph = gm._graph('partyGraph');
var _ = require('underscore');
var party = graph.party.save(_.omit(args[0], 'members'));
graph.member.save(party._id, args[1]._id, { admin: true });
return party;
});
示例3: on
on(actions.queueGameUpdate, (state, action) => {
const { update } = action.payload;
return {
...state,
updates: omit(state.updates, update.itemId),
};
});
示例4: on
on(actions.snoozeCave, (state, action) => {
const { caveId } = action.payload;
return {
...state,
updates: omit(state.updates, caveId),
};
});
示例5: on
on(actions.localeDownloadStarted, (state, action) => {
const { lang } = action.payload;
return {
...state,
queued: omit(state.downloading, lang),
downloading: { ...state.downloading, [lang]: true },
};
});
示例6: on
on(actions.taskEnded, (state, action) => {
const { id } = action.payload;
return {
...state,
tasks: omit(state.tasks, id),
finishedTasks: [state.tasks[id], ...state.finishedTasks],
};
});
示例7: on
on(actions.focusTab, (state, action) => {
const { tab } = action.payload;
const oldInstance = state[tab];
// wake up any sleepy tabs
if (oldInstance && oldInstance.sleepy) {
return {
...state,
[tab]: omit(oldInstance, "sleepy"),
};
}
return state;
});
示例8: getInfos
return getInfos(accountKey).then((infos) => {
infos[itemKey] = _.omit(this, 'save');
if (_.isEmpty(infos[itemKey])) {
delete infos[itemKey];
}
setInfos(accountKey, infos)
.catch((e) => {
toaster.pop('error',
t('ItemInfoService.SaveInfoErrorTitle'),
t('ItemInfoService.SaveInfoErrorDescription', { error: e.message }));
console.error("Error saving item info (tags, notes):", e);
reportException('itemInfo', e);
});
});
示例9: getLoadoutItem
// A special getItem that takes into account the fact that
// subclasses have unique IDs, and emblems/shaders/etc are interchangeable.
function getLoadoutItem(pseudoItem: DimItem, store: DimStore): DimItem | null {
let item = store.getStoresService().getItemAcrossStores(_.omit(pseudoItem, 'amount'));
if (!item) {
return null;
}
if (['Class', 'Shader', 'Emblem', 'Emote', 'Ship', 'Horn'].includes(item.type)) {
// Same character first
item =
store.items.find((i) => i.hash === pseudoItem.hash) ||
// Then other characters
store.getStoresService().getItemAcrossStores({ hash: item.hash }) ||
item;
}
return item;
}