1.0.5 • Published 7 years ago

promisory v1.0.5

Weekly downloads
2
License
ISC
Repository
github
Last release
7 years ago

Promisory

CircleCI npm npm

Write API's with support for callbacks and Promises. Slim wrapper for JS return statements.

installation

  npm i promisory -S

Test

  npm test

Usage

More examples can be found in the test

import promisory from 'promisory';
  const getName = (firstname = '', callback) => {
    if (firstname) {
      return promisory.resolve(firstname, callback)
    }
    return promisory.reject(null, callback);
  }
Promise
  getName('Josh')
    .then((result) => console.log('Result: ', result))
    .catch((error) => console.log('ERROR: ', error));
Callback
  getName('Josh', (error, result) => {
    if (error) {
      console.log('ERROR: ', error);
    } else {
      console.log('Result ', result)  
    }
  });
1.0.5

7 years ago

1.0.4

7 years ago

1.0.2

7 years ago

1.0.1

7 years ago

1.0.0

7 years ago