Array
22 snippets
Chunk Array
VerifiedSplits an array into groups of a given size, e.g. for batching API requests or building grids.
Group By
VerifiedGroups an array of items into an object keyed by a property or computed value.
Shuffle
VerifiedReturns a uniformly shuffled copy of an array (Fisher–Yates) without mutating it.
Unique
VerifiedRemoves duplicates from an array, optionally by a key or function, keeping order.
Binary Search
Searches for an element in a sorted array using binary search.
Chunk Array
Splits an array into chunks of a specified size.
Compare Arrays
Deeply compares two arrays to check if they are equal to each other (supports nested arrays and objects).
Filter
Filters a vector using a predicate function.
Find Duplicates in a List
Identifies duplicate elements in a list.
Find Intersection of Two Lists
Finds the common elements between two lists.
Find Maximum Difference in List
Finds the maximum difference between any two elements in a list.
Flatten Nested List
Flattens a multi-dimensional list into a single list.
Flatten Unevenly Nested Lists
Converts unevenly nested lists of any depth into a single flat list.
Matrix Transpose
Transposes a 2D matrix.
Partition Array
Splits an array into two arrays based on a callback function.
Partition List
Partitions a list into sublists of a given size.
Remove Falsy Values
Removes falsy values from an array.
Remove n Occurences
Removes duplicates from an vector of ints
Swap items at index
Swaps two items at determined indexes
Transform
Transforms a vector using a function.
Zip Arrays
Combines two arrays by pairing corresponding elements from each array.
Zip Two Lists
Zips two lists into a list of paired elements, combining corresponding elements from both lists.