Rename: setDifference -> difference (#3177)
* Improve setDifference * Rename: setDifference -> difference
This commit is contained in:
@ -18,8 +18,12 @@ export function erase<T>(x: T, xs: T[]): T[] {
|
||||
return xs.filter(y => x !== y);
|
||||
}
|
||||
|
||||
export function setDifference<T>(xs: T[], ys: T[]): T[] {
|
||||
return xs.filter(x => !ys.includes(x));
|
||||
/**
|
||||
* Finds the array of all elements in the first array not contained in the second array.
|
||||
* The order of result values are determined by the first array.
|
||||
*/
|
||||
export function difference<T>(includes: T[], excludes: T[]): T[] {
|
||||
return includes.filter(x => !excludes.includes(x));
|
||||
}
|
||||
|
||||
export function unique<T>(xs: T[]): T[] {
|
||||
|
Reference in New Issue
Block a user