Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

@promises/from-callback

yisraelx15MIT0.5.0TypeScript support: included

From Callback is package from Promises library

promise, promises, utilities, utility, utils, modules, modular, async, await, deferred

readme

@promises/from-callback

Source Code Version MIT License Bundle Size

From Callback is package from Promises library

Use

Module

$ npm install --save @promises/from-callback
import {
 default as fromCallback
} from '@promises/from-callback';

Browser

<script src="https://unpkg.com/@promises/from-callback/bundle.umd.min.js"></script>
let {
 fromCallback
} = P;

Examples

 fromCallback<string[]>((callback) => {
     fs.readdir(process.cwd(), callback);
 }).then((result: string[]) => {
     console.log(result);
 });

Wrapper

Module

$ npm install --save @promises/from-callback
import Promises from '@promises/core';
import '@promises/from-callback/add';

Or

import Promises from '@promises/from-callback/add';

Browser

<script src="https://unpkg.com/@promises/core/bundle.umd.min.js"></script>
<script src="https://unpkg.com/@promises/from-callback/add/bundle.umd.min.js"></script>
let {
 Promises
} = P;

Examples

 let readDir = fs.readdir.bind(null, process.cwd());
 Promises.fromCallback<string[]>(readDir).then((result: string[]) => {
     console.log(result);
 });

Compatibility

These modules are written in typescript and available in ES5 and ES6 standard, the requirements are a global Promise (native or polyfill).

License

Copyright © 2017 Yisrael Eliav, Licensed under the MIT license.

changelog

Change Log

All notable changes to this project will be documented in this file. See Conventional Commits for commit guidelines.

0.5.0 (2018-07-16)

build

  • move from webpack to rollup, compatibility changes (47594dc)

Code Refactoring

  • separates add and export, adds 'add' file to groups packages (be1e7f6)

Features

  • add Tree-Shaking & esm support and convert "add" to sub-package (0aa2297)

BREAKING CHANGES

  • change in wrapper use, for use in wrapper:
    import Promises from '@promises/-all/add';
    Or
    import Promises from '@promises/core';
    import '@promises/-all/add';
  • new compatibility support:
  • main - commonjs module and es5 standard (index.js)
  • es2015 - commonjs module and es2015 standard (index.es6.js)
  • browser - bundle in umd format includes all scope dependencies in es5 standard (bundle.umd.js, bundle.umd.min.js)
  • typings - typescript declaration file (index.d.ts)
  • "add" does not export the "index" export, it only adds to Promises
    import Promises from '@promises/core';
    import '@promises/for-each-series/add';

0.3.1 (2018-03-05)

Note: Version bump only for package @promises/from-callback

0.3.0 (2018-03-05)

Features

  • add method fromCallback (78acfa7)