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.
@saber2pr/fp
Advanced tools
functional programing in async | sync | lazy.
# from npm
npm install @saber2pr/fp
# from github
git clone https://github.com/Saber2pr/fp.git
If you often program with node.js, there will be some bad cases in async, like this:
const contents = await Promise.all(
['./1.txt', './2.txt'].map(async file_name => ({
content1: await readFile(file_name).then(buffer => buffer.toString()),
content2: await readFile(file_name).then(buffer => buffer.toString())
}))
)
then you get a bad result, the contents.content1
and contents.content2
is a Promise
Now, there is a function named async_map
to it:
const contents = async_map(['./1.txt', './2.txt'], async file_name => ({
content1: await readFile(file_name).then(buffer => buffer.toString()),
content2: await readFile(file_name).then(buffer => buffer.toString())
}))
you will get a result and the contents.content1
and contents.content2
is the correct type "string".
what's more...
compose
pipe
setter
async_reduce
async_reduceRight
async_compose
async_pipe
async_setter
async_forEach
async_filter
async_intercept
async_map
*range
*map
*filter
*reduce
toIt
from
npm install
npm start
npm test
Author: saber2pr
you should write ts in /src
you should make test in /src/test
export your core in /src/index.ts!
FAQs
> functional programing in async & sync.
We found that @saber2pr/fp 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.
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.