@google-cloud/promisify
- Version 4.0.0
- Published
- 36.5 kB
- No dependencies
- Apache-2.0 license
Install
npm i @google-cloud/promisify
yarn add @google-cloud/promisify
pnpm add @google-cloud/promisify
Overview
A simple utility for promisifying functions and classes.
Index
Functions
function callbackify
callbackify: (originalMethod: CallbackMethod) => CallbackMethod;
Wraps a promisy type function to conditionally call a callback function.
Parameter originalMethod
The method to callbackify.
Parameter options
Callback options.
Parameter
{boolean} options.singular - Pass to the callback a single arg instead of an array. {function} wrapped
function callbackifyAll
callbackifyAll: (Class: Function, options?: CallbackifyAllOptions) => void;
Callbackifies certain Class methods. This will not callbackify private or streaming methods.
Parameter Class
Service class.
Parameter options
Configuration object.
function promisify
promisify: (originalMethod: PromiseMethod, options?: PromisifyOptions) => any;
Wraps a callback style function to conditionally return a promise.
Parameter originalMethod
The method to promisify.
Parameter options
Promise options.
Parameter
{boolean} options.singular - Resolve the promise with single arg instead of an array. {function} wrapped
function promisifyAll
promisifyAll: (Class: Function, options?: PromisifyAllOptions) => void;
Promisifies certain Class methods. This will not promisify private or streaming methods.
Parameter Class
Service class.
Parameter options
Configuration object.
Interfaces
interface CallbackifyAllOptions
interface CallbackifyAllOptions {}
property exclude
exclude?: string[];
Array of methods to ignore when callbackifying.
interface CallbackMethod
interface CallbackMethod extends Function {}
property callbackified_
callbackified_?: boolean;
interface PromiseMethod
interface PromiseMethod extends Function {}
property promisified_
promisified_?: boolean;
interface PromisifyAllOptions
interface PromisifyAllOptions extends PromisifyOptions {}
property exclude
exclude?: string[];
Array of methods to ignore when promisifying.
interface PromisifyOptions
interface PromisifyOptions {}
property singular
singular?: boolean;
Resolve the promise with single arg instead of an array.
interface WithPromise
interface WithPromise {}
property Promise
Promise?: PromiseConstructor;
Package Files (1)
Dependencies (0)
No dependencies.
Dev Dependencies (13)
Peer Dependencies (0)
No peer dependencies.
Badge
To add a badge like this oneto your package's README, use the codes available below.
You may also use Shields.io to create a custom badge linking to https://www.jsdocs.io/package/@google-cloud/promisify
.
- Markdown[![jsDocs.io](https://img.shields.io/badge/jsDocs.io-reference-blue)](https://www.jsdocs.io/package/@google-cloud/promisify)
- HTML<a href="https://www.jsdocs.io/package/@google-cloud/promisify"><img src="https://img.shields.io/badge/jsDocs.io-reference-blue" alt="jsDocs.io"></a>
- Updated .
Package analyzed in 2804 ms. - Missing or incorrect documentation? Open an issue for this package.