
Research
PyPI Package Disguised as Instagram Growth Tool Harvests User Credentials
A deceptive PyPI package posing as an Instagram growth tool collects user credentials and sends them to third-party bot services.
promiseback
Advanced tools
Accept an optional node-style callback, and also return a spec-compliant Promise!
Accept an optional node-style callback, and also return a spec-compliant Promise!
var promiseback = require('promiseback');
var callback = function (err, value) {};
/* without a promise: */
promiseback(callback);
/*
- will throw if `callback` is not a function
- returns a "deferred"
- has resolve/reject methods, and `promise` property
- will call `callback` as expected when deferred is resolved
*/
/* with a promise: */
promiseback(promise, callback);
/*
- will throw if `callback` is truthy and not a function
- `promise` will be converted to a Promise, so you can pass a value as well
- returns a Promise
- will call `callback` as expected when the promise is fulfilled
*/
Using deferreds:
var promiseback = require('promiseback');
module.exports = function doSomethingCool(thing, callback) {
// If callback is not provided, this code will simply return a normal promise.
// If callback is provided but is not a function, promiseback will immediately throw a TypeError.
// "deferred" is an object with `reject/resolve` methods, and a `promise` property.
var deferred = promiseback(callback);
if (thing) {
deferred.resolve(thing);
} else {
deferred.reject(thing);
}
return deferred.promise;
};
Using a straight promise, when you can get it from somewhere else:
var promiseback = require('promiseback');
module.exports = function doSomethingCool(thing, callback) {
// If callback is not provided, this code will simply return a normal promise.
// If callback is provided but is not a function, promiseback will immediately throw a TypeError.
var newThingPromise = makeNewThing(thing);
return promiseback(newThingPromise, callback);
};
Simply clone the repo, npm install
, and run npm test
FAQs
Accept an optional node-style callback, and also return a spec-compliant Promise!
The npm package promiseback receives a total of 106,861 weekly downloads. As such, promiseback popularity was classified as popular.
We found that promiseback 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
A deceptive PyPI package posing as an Instagram growth tool collects user credentials and sends them to third-party bot services.
Product
Socket now supports pylock.toml, enabling secure, reproducible Python builds with advanced scanning and full alignment with PEP 751's new standard.
Security News
Research
Socket uncovered two npm packages that register hidden HTTP endpoints to delete all files on command.