0.1.2 • Published 6 years ago
set-findall v0.1.2
set-findall
NOTE: set-findall was renamed to @extra-set/find-all.
Get all values in set that satisfy the test, like Array.find().
const findAll = require('set-findall');
// findAll(<set>, <test function>, [this], [target=new Set()])
var set = new Set('scout');
findAll(set, (v) => v>'s');
// Set {'u', 't'}
findAll(set, (v, k, set) => v>='s', null);
// Set {'s', 'u', 't'}
findAll(set, (v, k, set) => v>='s', null, new Set(['z']));
// Set {'z', 's', 'u', 't'}
findAll(set, (v, k, set) => v>='s', null, set);
// Set {'s', 'u', 't'} (set is modified)