1.1.1 • Published 7 years ago
@extra-iterable/compact v1.1.1
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]