Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Basic Async Utilities #194

Closed
wants to merge 5 commits into from
Closed

Basic Async Utilities #194

wants to merge 5 commits into from

Conversation

daedalus28
Copy link
Contributor

@daedalus28 daedalus28 commented Jan 30, 2018

  • Add Async methods: flowAsync, flurryAsync, promisedProps, mapAsync, mapValuesAsync
  • Add flatMapIndexed, throwsError

Fixes #107

@decrapifier
Copy link
Contributor

decrapifier commented Jan 30, 2018

Fails
🚫

Your PR has 8 failed browser tests:

Suite: Async Functions
Description: flurryAsync
Timeout of 2000ms exceeded. For async tests and hooks, ensure "done()" is called; if returning a Promise, ensure it resolves.
tryCatcher@base/test/async.spec.js?1c3843c03c656312138d68e69be42c419037d071:19751:28
_settlePromiseFromHandler@base/test/async.spec.js?1c3843c03c656312138d68e69be42c419037d071:17773:35
_settlePromise@base/test/async.spec.js?1c3843c03c656312138d68e69be42c419037d071:17830:43
_settlePromise0@base/test/async.spec.js?1c3843c03c656312138d68e69be42c419037d071:17875:24
_settlePromises@base/test/async.spec.js?1c3843c03c656312138d68e69be42c419037d071:17954:33
_drainQueue@base/test/async.spec.js?1c3843c03c656312138d68e69be42c419037d071:14683:31
_drainQueues@base/test/async.spec.js?1c3843c03c656312138d68e69be42c419037d071:14693:21
drainQueues@base/test/async.spec.js?1c3843c03c656312138d68e69be42c419037d071:14567:26
run@base/node_modules/babel-polyfill/dist/polyfill.js?03b9323c0501aae92009b27cf63cea3f4754b408:3911:29
base/node_modules/babel-polyfill/dist/polyfill.js?03b9323c0501aae92009b27cf63cea3f4754b408:3924:31
flush@base/node_modules/babel-polyfill/dist/polyfill.js?03b9323c0501aae92009b27cf63cea3f4754b408:1209:11

Suite: Async Functions
Description: mapAsync
Timeout of 2000ms exceeded. For async tests and hooks, ensure "done()" is called; if returning a Promise, ensure it resolves.
tryCatcher@base/test/async.spec.js?1c3843c03c656312138d68e69be42c419037d071:19751:28
_settlePromiseFromHandler@base/test/async.spec.js?1c3843c03c656312138d68e69be42c419037d071:17773:35
_settlePromise@base/test/async.spec.js?1c3843c03c656312138d68e69be42c419037d071:17830:43
_settlePromise0@base/test/async.spec.js?1c3843c03c656312138d68e69be42c419037d071:17875:24
_settlePromises@base/test/async.spec.js?1c3843c03c656312138d68e69be42c419037d071:17954:33
_drainQueue@base/test/async.spec.js?1c3843c03c656312138d68e69be42c419037d071:14683:31
_drainQueues@base/test/async.spec.js?1c3843c03c656312138d68e69be42c419037d071:14693:21
drainQueues@base/test/async.spec.js?1c3843c03c656312138d68e69be42c419037d071:14567:26
run@base/node_modules/babel-polyfill/dist/polyfill.js?03b9323c0501aae92009b27cf63cea3f4754b408:3911:29
base/node_modules/babel-polyfill/dist/polyfill.js?03b9323c0501aae92009b27cf63cea3f4754b408:3924:31
flush@base/node_modules/babel-polyfill/dist/polyfill.js?03b9323c0501aae92009b27cf63cea3f4754b408:1209:11

Suite: Async Functions
Description: mapValuesAsync
Timeout of 2000ms exceeded. For async tests and hooks, ensure "done()" is called; if returning a Promise, ensure it resolves.
tryCatcher@base/test/async.spec.js?1c3843c03c656312138d68e69be42c419037d071:19751:28
_settlePromiseFromHandler@base/test/async.spec.js?1c3843c03c656312138d68e69be42c419037d071:17773:35
_settlePromise@base/test/async.spec.js?1c3843c03c656312138d68e69be42c419037d071:17830:43
_settlePromise0@base/test/async.spec.js?1c3843c03c656312138d68e69be42c419037d071:17875:24
_settlePromises@base/test/async.spec.js?1c3843c03c656312138d68e69be42c419037d071:17954:33
_drainQueue@base/test/async.spec.js?1c3843c03c656312138d68e69be42c419037d071:14683:31
_drainQueues@base/test/async.spec.js?1c3843c03c656312138d68e69be42c419037d071:14693:21
drainQueues@base/test/async.spec.js?1c3843c03c656312138d68e69be42c419037d071:14567:26
run@base/node_modules/babel-polyfill/dist/polyfill.js?03b9323c0501aae92009b27cf63cea3f4754b408:3911:29
base/node_modules/babel-polyfill/dist/polyfill.js?03b9323c0501aae92009b27cf63cea3f4754b408:3924:31
flush@base/node_modules/babel-polyfill/dist/polyfill.js?03b9323c0501aae92009b27cf63cea3f4754b408:1209:11

Suite: Async Functions
Description: mapAsync
Timeout of 2000ms exceeded. For async tests and hooks, ensure "done()" is called; if returning a Promise, ensure it resolves.
tryCatcher@base/test/async.spec.js?1c3843c03c656312138d68e69be42c419037d071:19751:28
_settlePromiseFromHandler@base/test/async.spec.js?1c3843c03c656312138d68e69be42c419037d071:17773:35
_settlePromise@base/test/async.spec.js?1c3843c03c656312138d68e69be42c419037d071:17830:43
_settlePromise0@base/test/async.spec.js?1c3843c03c656312138d68e69be42c419037d071:17875:24
_settlePromises@base/test/async.spec.js?1c3843c03c656312138d68e69be42c419037d071:17954:33
_drainQueue@base/test/async.spec.js?1c3843c03c656312138d68e69be42c419037d071:14683:31
_drainQueues@base/test/async.spec.js?1c3843c03c656312138d68e69be42c419037d071:14693:21
drainQueues@base/test/async.spec.js?1c3843c03c656312138d68e69be42c419037d071:14567:26
promiseReactionJob@[native code]

Suite: Async Functions
Description: mapValuesAsync
Timeout of 2000ms exceeded. For async tests and hooks, ensure "done()" is called; if returning a Promise, ensure it resolves.
tryCatcher@base/test/async.spec.js?1c3843c03c656312138d68e69be42c419037d071:19751:28
_settlePromiseFromHandler@base/test/async.spec.js?1c3843c03c656312138d68e69be42c419037d071:17773:35
_settlePromise@base/test/async.spec.js?1c3843c03c656312138d68e69be42c419037d071:17830:43
_settlePromise0@base/test/async.spec.js?1c3843c03c656312138d68e69be42c419037d071:17875:24
_settlePromises@base/test/async.spec.js?1c3843c03c656312138d68e69be42c419037d071:17954:33
_drainQueue@base/test/async.spec.js?1c3843c03c656312138d68e69be42c419037d071:14683:31
_drainQueues@base/test/async.spec.js?1c3843c03c656312138d68e69be42c419037d071:14693:21
drainQueues@base/test/async.spec.js?1c3843c03c656312138d68e69be42c419037d071:14567:26
promiseReactionJob@[native code]

Suite: Async Functions
Description: flowAsync
Timeout of 2000ms exceeded. For async tests and hooks, ensure "done()" is called; if returning a Promise, ensure it resolves.
tryCatcher@base/test/async.spec.js?1c3843c03c656312138d68e69be42c419037d071:19751:28
_settlePromiseFromHandler@base/test/async.spec.js?1c3843c03c656312138d68e69be42c419037d071:17773:35
_settlePromise@base/test/async.spec.js?1c3843c03c656312138d68e69be42c419037d071:17830:43
_settlePromise0@base/test/async.spec.js?1c3843c03c656312138d68e69be42c419037d071:17875:24
_settlePromises@base/test/async.spec.js?1c3843c03c656312138d68e69be42c419037d071:17954:33
_drainQueue@base/test/async.spec.js?1c3843c03c656312138d68e69be42c419037d071:14683:31
_drainQueues@base/test/async.spec.js?1c3843c03c656312138d68e69be42c419037d071:14693:21
drainQueues@base/test/async.spec.js?1c3843c03c656312138d68e69be42c419037d071:14567:26
run@base/node_modules/babel-polyfill/dist/polyfill.js?03b9323c0501aae92009b27cf63cea3f4754b408:3911:29
base/node_modules/babel-polyfill/dist/polyfill.js?03b9323c0501aae92009b27cf63cea3f4754b408:3924:31
flush@base/node_modules/babel-polyfill/dist/polyfill.js?03b9323c0501aae92009b27cf63cea3f4754b408:1209:11

Suite: Async Functions
Description: flurryAsync
Timeout of 2000ms exceeded. For async tests and hooks, ensure "done()" is called; if returning a Promise, ensure it resolves.
tryCatcher@base/test/async.spec.js?1c3843c03c656312138d68e69be42c419037d071:19751:28
_settlePromiseFromHandler@base/test/async.spec.js?1c3843c03c656312138d68e69be42c419037d071:17773:35
_settlePromise@base/test/async.spec.js?1c3843c03c656312138d68e69be42c419037d071:17830:43
_settlePromise0@base/test/async.spec.js?1c3843c03c656312138d68e69be42c419037d071:17875:24
_settlePromises@base/test/async.spec.js?1c3843c03c656312138d68e69be42c419037d071:17954:33
_drainQueue@base/test/async.spec.js?1c3843c03c656312138d68e69be42c419037d071:14683:31
_drainQueues@base/test/async.spec.js?1c3843c03c656312138d68e69be42c419037d071:14693:21
drainQueues@base/test/async.spec.js?1c3843c03c656312138d68e69be42c419037d071:14567:26
run@base/node_modules/babel-polyfill/dist/polyfill.js?03b9323c0501aae92009b27cf63cea3f4754b408:3911:29
base/node_modules/babel-polyfill/dist/polyfill.js?03b9323c0501aae92009b27cf63cea3f4754b408:3924:31
flush@base/node_modules/babel-polyfill/dist/polyfill.js?03b9323c0501aae92009b27cf63cea3f4754b408:1209:11

Suite: Async Functions
Description: mapValuesAsync
Timeout of 2000ms exceeded. For async tests and hooks, ensure "done()" is called; if returning a Promise, ensure it resolves.
tryCatcher@base/test/async.spec.js?1c3843c03c656312138d68e69be42c419037d071:19751:28
_settlePromiseFromHandler@base/test/async.spec.js?1c3843c03c656312138d68e69be42c419037d071:17773:35
_settlePromise@base/test/async.spec.js?1c3843c03c656312138d68e69be42c419037d071:17830:43
_settlePromise0@base/test/async.spec.js?1c3843c03c656312138d68e69be42c419037d071:17875:24
_settlePromises@base/test/async.spec.js?1c3843c03c656312138d68e69be42c419037d071:17954:33
_drainQueue@base/test/async.spec.js?1c3843c03c656312138d68e69be42c419037d071:14683:31
_drainQueues@base/test/async.spec.js?1c3843c03c656312138d68e69be42c419037d071:14693:21
drainQueues@base/test/async.spec.js?1c3843c03c656312138d68e69be42c419037d071:14567:26
run@base/node_modules/babel-polyfill/dist/polyfill.js?03b9323c0501aae92009b27cf63cea3f4754b408:3911:29
base/node_modules/babel-polyfill/dist/polyfill.js?03b9323c0501aae92009b27cf63cea3f4754b408:3924:31
flush@base/node_modules/babel-polyfill/dist/polyfill.js?03b9323c0501aae92009b27cf63cea3f4754b408:1209:11

Generated by 🚫 dangerJS

@ghost ghost assigned decrapifier Jan 30, 2018
@daedalus28 daedalus28 mentioned this pull request Jan 31, 2018
@daedalus28 daedalus28 changed the title Feature/async Basic Async Utilities Jan 31, 2018
@daedalus28
Copy link
Contributor Author

daedalus28 commented Jan 31, 2018

The big open question here is how deep we want to go on this because mapAsync opens up the door for async everything. It's useful in practice, but as mentioned in #84 it might make more sense as a bluebird-fp lib.

@daedalus28
Copy link
Contributor Author

A potential alternative: https://runkit.com/daedalus28/flexible-flow-async

The main idea there is to avoid needing things like mapValuesAsync (and thus, eventually everySingleMethodAsync) by making the async flow smart enough to automatically leverage the basic primitives during the composition (e.g. automatically using Promise.all or Promise.props).

@daedalus28
Copy link
Contributor Author

Closing in favor of #411

@daedalus28 daedalus28 closed this Mar 24, 2023
@daedalus28 daedalus28 deleted the feature/Async branch March 24, 2023 19:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Implement an async flow
2 participants