Meet npm Pro: unlimited public & private packages + package-based permissions.Learn more »

user-async-function

1.1.3 • Public • Published

user-async-function

Build Status Coverage Status

This module exports a function that calls a user function and waits for its completion. This function can be a callback-calling function, an async/await function, or a promise-returning function.

How to use

const userAsyncFunction = require('user-async-function')
 
// somewhere in your code...
function someFunction(userOptions) {
  userAsyncFunction(userOptions.someAsyncFunction).then(...)
}
 
// or in an async function
async function someFunction(userOptions) {
  await userAsyncFunction(userOptions.someAsyncFunction)
}
 
// Pass extra arguments at will
// They will be passed to the user function (before the callback)
userAsyncFunction(fn, 'arg1', 'arg2'/*, ...*/)

Keywords

none

Install

npm i user-async-function

DownloadsWeekly Downloads

38

Version

1.1.3

License

MIT

Unpacked Size

2.53 kB

Total Files

3

Last publish

Collaborators

  • avatar