Research
Security News
Malicious npm Package Targets Solana Developers and Hijacks Funds
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
Make a JavaScript function support both promise and callback styles.
This is great if you want to offer your users the choice between the two. It is also an elegant way to support older platforms without Promise support and let the users decide if they want to add a Promise polyfill.
npm install polygoat
var pg = require('polygoat');
or
<script src="node_modules/polygoat/index.js"></script>
var pg = window.polygoat
// wrap and expose your asynchronous function with polygoat
function myFunction (some, arg, callback) {
return pg(function (done) {
doSomethingAsync(some, arg, done)
}, callback)
}
// myFunction can now be used with promise style
myFunction('foo', 'bar').then(console.log)
// or callback style
myFunction('foo', 'bar', console.log)
// you can also pass the Promise implementation you wish polygoat to use
var bluebird = require('bluebird')
function myFunction (callback) {
return pg(function (done) {
doSomethingAsync(done)
}, callback, bluebird)
}
myFunction() instanceof bluebird // true
See example.js
npm install standard
npm test
Goat icon by Agne Alesiute from the Noun Project
FAQs
Make JavaScript functions that support both promise and callback styles.
The npm package polygoat receives a total of 592 weekly downloads. As such, polygoat popularity was classified as not popular.
We found that polygoat 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
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
Security News
Research
Socket researchers have discovered malicious npm packages targeting crypto developers, stealing credentials and wallet data using spyware delivered through typosquats of popular cryptographic libraries.
Security News
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.