1.1.1 • Published 6 years ago

@manitoulin-transport/p-call v1.1.1

Weekly downloads
-
License
MIT
Repository
-
Last release
6 years ago

p-call

Call a legacy async method and return a promise

Very similar to promisify-call but always promisifies the call, rather than guessing if it should.


Example

Instead of using the legacy error-first callback API ...

object.method(argument, (error, result) => {
  if (error) {
    throw error
  }
  console.log(result)
})

Use the Promise API ...

const result = await pCall(object, object.method, argument)
console.log(result)

// Or, specify the function as a property key of `object`...
const result = await pCall(object, 'method', argument)
console.log(result)
1.1.1

6 years ago

1.1.0

6 years ago

1.0.1

6 years ago

1.0.0

6 years ago