source:
node_modules/es-toolkit/dist/array/compact.mjs@
ba17441
| Last change on this file since ba17441 was a762898, checked in by , 5 months ago | |
|---|---|
|
|
| File size: 228 bytes | |
| Rev | Line | |
|---|---|---|
| [a762898] | 1 | function compact(arr) { |
| 2 | const result = []; | |
| 3 | for (let i = 0; i < arr.length; i++) { | |
| 4 | const item = arr[i]; | |
| 5 | if (item) { | |
| 6 | result.push(item); | |
| 7 | } | |
| 8 | } | |
| 9 | return result; | |
| 10 | } | |
| 11 | ||
| 12 | export { compact }; |
Note:
See TracBrowser
for help on using the repository browser.
