本文整理匯總了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;
}