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.
Tap into a promise chain without affecting its value or state
$ npm install p-tap
import pTap from 'p-tap';
Promise.resolve('unicorn')
.then(pTap(console.log)) // Logs `unicorn`
.then(value => {
// `value` is still `unicorn`
});
import pTap from 'p-tap';
getUser()
.then(pTap(user => recordStatsAsync(user))) // Stats are saved about `user` async before the chain continues
.then(user => {
// `user` is the user from getUser(), not recordStatsAsync()
});
import pTap from 'p-tap';
Promise.resolve(() => doSomething())
.catch(pTap.catch(console.error)) // Prints any errors
.then(handleSuccess)
.catch(handleError);
Use this in a .then()
method.
Returns a thunk that returns a Promise
.
Use this in a .catch()
method.
Returns a thunk that returns a Promise
.
Type: Function
Any return value is ignored. Exceptions thrown in tapHandler
are relayed back to the original promise chain.
If tapHandler
returns a Promise
, it will be awaited before passing through the original value.
FAQs
Tap into a promise chain without affecting its value or state
We found that p-tap 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.