1.1.1 • Published 7 years ago

@extra-iterable/compact v1.1.1

Weekly downloads
-
License
MIT
Repository
github
Last release
7 years ago

Remove falsy values from iterable, like _.compact().

const compact = require('@extra-iterable/compact');
// compact(<iterable>, [begin=0], [end], [target=[]], [at])

compact(new Set([7, 2, null, 1, 0, undefined]));
// [7, 2, 1]
compact([7, 2, null, 1, 0, undefined], 1);
// [2, 1]
compact([7, 2, null, 1, 0, undefined], 1, 3);
// [2]
compact([7, 2, null, 1, 0, undefined], 1, 3, [9, 8]);
// [9, 8, 2]
compact([7, 2, null, 1, 0, undefined], 1, 3, [9, 8], 1);
// [9, 2]

extra-iterable