frontend client for gemstone. decentralised workplace app
2
fork

Configure Feed

Select the types of activity you want to include in your feed.

feat: array partition helper

serenity f8409aa8 eda470ed

+17
+17
src/lib/utils/arrays.ts
··· 1 + export const partition = <T>( 2 + array: Array<T>, 3 + predicate: (value: T, index: number, array: Array<T>) => boolean, 4 + ): [Array<T>, Array<T>] => { 5 + const truthy: Array<T> = []; 6 + const falsy: Array<T> = []; 7 + 8 + array.forEach((value, index, arr) => { 9 + if (predicate(value, index, arr)) { 10 + truthy.push(value); 11 + } else { 12 + falsy.push(value); 13 + } 14 + }); 15 + 16 + return [truthy, falsy]; 17 + };