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

isAsyncFn should check if function filter returns a promise #7

Open
niftylettuce opened this issue Jun 12, 2017 · 3 comments
Open

isAsyncFn should check if function filter returns a promise #7

niftylettuce opened this issue Jun 12, 2017 · 3 comments

Comments

@niftylettuce
Copy link
Contributor

No description provided.

@niftylettuce
Copy link
Contributor Author

example:

      curl: cmd => {
        cmd = cmd.split('\n').join('\\\n');
        return new Promise(async (resolve, reject) => {
          try {
            const response = await exec(cmd, {
              stdio: 'ignore',
              timeout: env.CURL_FILTER_TIMEOUT_MS
            });
            console.log('response', response);
            resolve(response.stdout ? response.stdout : response);
          } catch (err) {
            console.log(err && err.stack);
            resolve(err.stderr ? err.stderr : err.message);
          }
        });
      }

I have to rewrite this in order for it to return true for

const isAsyncFn = fn => {

@niftylettuce
Copy link
Contributor Author

when it gets compiled down with babel this is removed I believe and therefore it has no support for this?

@beliefgp
Copy link
Owner

I have thought about your code when commit this fix.
it well run twice lead to affect performance when use return promise.
so I do not recommend using babel compilation,support node > 7.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants