
Security News
Feross on the 10 Minutes or Less Podcast: Nobody Reads the Code
Socket CEO Feross Aboukhadijeh joins 10 Minutes or Less, a podcast by Ali Rohde, to discuss the recent surge in open source supply chain attacks.
A handy function to filter Strings, Arrays, TypedArrays, Maps, Sets, (any Iterables) & Objects.
A handy function for filtering any iterable and objects in javascript.
$ yarn add filter-it
# or
$ npm i -S filter-it
The api is straight forward and oriented on Array.prototype.filter.
const newIterable = filter(iterable, callback);
The iterable or object to filter. Supported types are String, Array, TypedArray, Map, Set, (any Iterable) & Object.
A function to test every element or value of the iterable. The current item will be preserved when the callback returns a truthy value.
The function takes 3 parameters:
filter() returns a new instance of the iterable with only the entries passed the callback.
filter("a1b2c3d4e5", char => char >= "0" && char <= "9");
// => "12345"
filter(new String("a1b2c3d4e5"), (char, index) => index & 1);
// => [String: '12345']
const map = new Map([['a', 1], ['b', 2], ['c', 3], ['d', 4], ['e', 5]]);
filter(map, (value, key) => key === 'b' || value & 1);
// => Map { 'a' => 1, 'b' => 2, 'c' => 3, 'e' => 5 }
const set = new Set(['a', 1, 'b', 2, 'c', 3]);
filter(set, (value, key) => value === key && typeof value === 'string');
// => Set { 'a', 'b', 'c' }
const arr = ['a', 1, 'b', 2, 'c', 3];
filter(arr, (value, index) => index & 1);
// => [ '1', '2', '3' ]
const typedArr = new Int32Array([1, 2, -3, -4, 5]);
filter(typedArr, i => i < 0);
// => Int32Array [ -3, -4 ]
const obj = { a: 1, b: 2, c: 3, d: 4, e: 5 };
filter(obj, (value, key) => key === 'b' || value & 1);
// => { a: 1, b: 2, c: 3, e: 5 }
FAQs
A handy function to filter Strings, Arrays, TypedArrays, Maps, Sets, (any Iterables) & Objects.
We found that filter-it demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Socket CEO Feross Aboukhadijeh joins 10 Minutes or Less, a podcast by Ali Rohde, to discuss the recent surge in open source supply chain attacks.

Research
/Security News
Campaign of 108 extensions harvests identities, steals sessions, and adds backdoors to browsers, all tied to the same C2 infrastructure.

Security News
OpenAI rotated macOS signing certificates after a malicious Axios package reached its CI pipeline in a broader software supply chain attack.