
Security News
Attackers Are Hunting High-Impact Node.js Maintainers in a Coordinated Social Engineering Campaign
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.
Promisify all function in an object, using relike.
npm i relike-all --save
For more use-cases see the tests
const relikeAll = require('relike-all')
Promisify functions in an object. You can pass
patternto filter what should be promisified and what not. Using is-match, which is thin wrapper around micromatch. You should install is-match, if you want to use filtering.
Params
<source> {Object|Function}: The source object to promisify.[pattern] {String|Array|RegExp|Function}: A glob pattern to filter, using micromatch.[options] {Object}: Options passed to micromatch.returns {Object|Function}: Same as incoming source.Example
const relikeAll = require('relike-all')
const fs = relikeAll(require('fs'))
fs.readFile('package.json', 'utf8')
.then(JSON.parse)
.then(data => {
console.log(data.name) // => 'relike-all'
return 'package.json'
})
.then(fs.statSync)
.then(stats => {
console.log(stats) // => Stats object
}, err => {
console.error(err.stack)
})
Returns a function that will wrap the given
fn. Instead of taking a callback, the returned function will return a promise whose fate is decided by the callback behavior of the givenfnnode function. The node function should conform to node.js convention of accepting a callback as last argument and calling that callback with error as the first argument and success value on the second argument. – Bluebird Docs on.promisify
Params
fn {Function}: Some sync or async function to promisify.[Promize] {Function}: Promise constructor to be used on enviroment where no support for native.returns {Function}: Promisified function, which always return a Promise.Example
const fs = require('fs')
const relikeAll = require('relike-all')
const readFile = relikeAll.promisify(fs.readFile)
readFile('package.json', 'utf8')
.then(JSON.parse)
.then(data => {
console.log(data.name) // => 'relike-all'
}, err => {
console.error(err.stack)
})
Customizing what Promise constructor to be used in old environments where there's no support for native Promise.
See more in relike's.Promisesection for more info.
Example
const fs = require('fs')
const relikeAll = require('relike-all')
// using `when` promise on node <= 0.11.12
relikeAll.promisify.Promise = require('when')
const readFile = relikeAll.promisify(fs.readFile)
const promise = readFile('index.js')
console.log(promise.Promise) // => The `when` promise constructor, on old enviroments
console.log(promise.___customPromise) // => `true` on old environments
letta to accept and handles more than functions only. Handles all… more | homepagePull requests and stars are always welcome. For bugs and feature requests, please create an issue.
But before doing anything, please read the CONTRIBUTING.md guidelines.
FAQs
Promisify all function in an object, using [relike][].
We found that relike-all 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
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.