UNPKG

es-toolkit

Version:

A state-of-the-art, high-performance JavaScript utility library with a small bundle size and strong type annotations.

13 lines (11 loc) 228 B
function compact(arr) { const result = []; for (let i = 0; i < arr.length; i++) { const item = arr[i]; if (item) { result.push(item); } } return result; } export { compact };