Security News
tea.xyz Spam Plagues npm and RubyGems Package Registries
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
nodeify
Advanced tools
Readme
Convert promised code to use node style callbacks. If no callback is provided it will just return the original promise.
Server:
$ npm install nodeify
Call nodeify
directly passing the promise
and an optional callback
as arguments. If a callback
is provided it will be called as callback(error, result)
. If callback
is not a function, promise
is returned.
var nodeify = require('nodeify');
function myAsyncMethod(arg, callback) {
return nodeify(myPromiseMethod(arg), callback);
}
The nodeify.Promise
constructor returns a promise with a .nodeify
method which behaves just like the functional version above except that the first argument is implicitly this
.
var Promise = require('nodeify').Promise;
function myAsyncMethod(arg, callback) {
return new Promise(function (resolver) {
//do async work
})
.nodeify(callback);
}
Takes a promise and extends it to support the .nodeify
method. It will still support the nodeify method after calls to .then
.
var Promise = require('promise');
var nodeify = require('nodeify');
function myAsyncMethod(arg, callback) {
return nodeify.extend(myPromiseMethod(arg))
.nodeify(callback);
}
Takes a PromiseConstructor and extends it to support the .nodeify
method.
var PromiseConstructor = require('promise-constructor-used-by-my-promise-method');
require('nodeify').extend(PromiseConstructor);
function myAsyncMethod(arg, callback) {
return myPromiseMethod(arg).nodeify(callback);
}
Extends the default promise constructor (returned by calling require('promise')
) and extends it to support .nodeify
.
require('nodeify').extend();
function myAsyncMethod(arg, callback) {
//assuming myPromiseMethod uses `promise` as its promise library
return myPromiseMethod(arg).nodeify(callback);
}
MIT
FAQs
Convert promised code to use node style callbacks
The npm package nodeify receives a total of 83,068 weekly downloads. As such, nodeify popularity was classified as popular.
We found that nodeify 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.
Security News
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
Security News
As cyber threats become more autonomous, AI-powered defenses are crucial for businesses to stay ahead of attackers who can exploit software vulnerabilities at scale.
Security News
UnitedHealth Group disclosed that the ransomware attack on Change Healthcare compromised protected health information for millions in the U.S., with estimated costs to the company expected to reach $1 billion.