/ piacw.com / dev / final / node_modules / thenify /

[ICO]NameLast modifiedSizeDescription
[PARENTDIR]Parent Directory  -  
[TXT]History.md2 years ago317 0fb859dc fixed mobile overflwo options [كارل مبارك]
[   ]LICENSE2 years ago1.1K0fb859dc fixed mobile overflwo options [كارل مبارك]
[TXT]README.md2 years ago3.7K0fb859dc fixed mobile overflwo options [كارل مبارك]
[   ]index.js2 years ago1.9K0fb859dc fixed mobile overflwo options [كارل مبارك]
[   ]package.json2 years ago1.8K0fb859dc fixed mobile overflwo options [كارل مبارك]
README.md

thenify

NPM version Build status Test coverage Dependency Status License Downloads

Promisify a callback-based function using any-promise.

An added benefit is that thrown errors in that async function will be caught by the promise!

API

fn = thenify(fn, options)

Promisifies a function.

Options

options are optional.

var thenify = require('thenify');

var somethingAsync = thenify(function somethingAsync(a, b, c, callback) {
  callback(null, a, b, c);
});
var thenify = require('thenify');

var somethingAsync = thenify(function somethingAsync(a, b, c, callback) {
  callback(null, a, b, c);
}, { withCallback: true });

// somethingAsync(a, b, c).then(onFulfilled).catch(onRejected);
// somethingAsync(a, b, c, function () {});

or use thenify.withCallback()

var thenify = require('thenify').withCallback;

var somethingAsync = thenify(function somethingAsync(a, b, c, callback) {
  callback(null, a, b, c);
});

// somethingAsync(a, b, c).then(onFulfilled).catch(onRejected);
// somethingAsync(a, b, c, function () {});
var thenify = require('thenify');

var promise = thenify(function (callback) {
  callback(null, 1, 2, 3);
}, { multiArgs: false });

// promise().then(function onFulfilled(value) {
//   assert.equal(value, 1);
// });
var thenify = require('thenify');

var promise = thenify(function (callback) {
  callback(null, 1, 2, 3);
}, { multiArgs: [ 'one', 'tow', 'three' ] });

// promise().then(function onFulfilled(value) {
//   assert.deepEqual(value, {
//     one: 1,
//     tow: 2,
//     three: 3
//   });
// });
Apache/2.4.38 (Debian) Server at www.karls.computer Port 80