Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Array.prototype.except = function(other, idSelector = obj => obj) {
const otherSet = new Set([]);
// Reference:
const difference = new Set(this.filter(object => !otherSet.has(idSelector(object))));
return [...difference];
function exceptDemo(ordersOnHold, domesticOrders, internationalOrders) {
const orderIdSelector = order =>;
const allOrders = domesticOrders.union(internationalOrders);
const allOrdersNotOnHold = allOrders.except(ordersOnHold, orderIdSelector);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.