Make thunks an array instead of an object

This commit is contained in:
Jon Staab
2025-10-17 10:32:08 -07:00
parent 642a4ce517
commit 543dbda64f
4 changed files with 34 additions and 12 deletions
+16
View File
@@ -568,6 +568,22 @@ export const partition = <T>(f: (x: T) => boolean, xs: T[]) => {
return [a, b]
}
/**
* Keeps items based on predicate
* @param f - Whether to remove an item from the array
* @param xs - Array of items to filter
* @returns Filtered array
*/
export const filter = <T>(f: (x: T) => any, xs: T[]) => xs.filter(f)
/**
* Removes items based on predicate
* @param f - Whether to remove an item from the array
* @param xs - Array of items to filter
* @returns Filtered array
*/
export const reject = <T>(f: (x: T) => any, xs: T[]) => xs.filter(complement(f))
/**
* Returns array with duplicate elements removed
* @param xs - Array with possible duplicates