Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
selectabular
Advanced tools
Common functionalities when dealing with table rows.
select.all(rows)
rows
array where each row has a .selected=true
attributeselect.none(rows)
rows
array where each row has a .selected=false
attributeselect.rows(filter)(rows)
Given a filter, it will select the matching rows and return them
const initRows = [
{ id: 10, selected: true, product: 'apple', company: 'Apple Inc', price: 1.5, stock: 300 },
{ id: 11, product: 'pear', company: 'Pear Inc', price: 3, stock: 1000 },
{ id: 12, product: 'grape', company: 'Grapesoft', price: 22.1, stock: 18 },
{ id: 13, product: 'banana', company: 'Banana Tech', price: 12, stock: 9 }
];
const myfilter = row => row.price > 5
const {rows, selectedRows: result } = selectabular.rows(myfilter)(initRows);
>> result
[
{ id: 12, product: 'grape', company: 'Grapesoft', price: 22.1, stock: 18 },
{ id: 13, product: 'banana', company: 'Banana Tech', price: 12, stock: 9 }
];
>> rows
[
{ id: 10, selected: true, product: 'apple', company: 'Apple Inc', price: 1.5, stock: 300 },
{ id: 11, product: 'pear', company: 'Pear Inc', price: 3, stock: 1000 },
{ id: 12, selected: true, product: 'grape', company: 'Grapesoft', price: 22.1, stock: 18 },
{ id: 13, selected: true, product: 'banana', company: 'Banana Tech', price: 12, stock: 9 }
];
rows
: original rows, where each row's .selected
is set to true
if it matches the filter.selectedRows
: array containing only those rows matching the filter.rows
does not toggle the rows that do not match the filter; please use select.none
a priori for that.rows
, and selectedRows
are internal variable names, used in the implementation; which can be easily renamed inline (See example where selectedRows
is renamed to result
)select.toggle(filter)(rows)
selected
attribute.const initRows = [
{ id: 10, selected: false, product: 'apple', company: 'Apple Inc', price: 1.5, stock: 300 },
{ id: 11, selected: true, product: 'pear', company: 'Pear Inc', price: 3, stock: 1000 },
{ id: 12, product: 'grape', company: 'Grapesoft', price: 22.1, stock: 18 },
{ id: 13, product: 'banana', company: 'Banana Tech', price: 12, stock: 9 }
];
const filter = row => row.id < 12
const result = selectabular.toggle(filter)(initRows);
>> result
[
{ id: 10, selected: true, product: 'apple', company: 'Apple Inc', price: 1.5, stock: 300 },
{ id: 11, selected: false, product: 'pear', company: 'Pear Inc', price: 3, stock: 1000 },
{ id: 12, product: 'grape', company: 'Grapesoft', price: 22.1, stock: 18 },
{ id: 13, product: 'banana', company: 'Banana Tech', price: 12, stock: 9 }
];
MIT. See LICENSE for details.
FAQs
Selection utilities
The npm package selectabular receives a total of 363 weekly downloads. As such, selectabular popularity was classified as not popular.
We found that selectabular demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 open source maintainers 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.
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.