Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

await-async-flow

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

await-async-flow

node await async flow

  • 1.0.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
2
Maintainers
1
Weekly downloads
 
Created
Source

await-async-flow

将 async 库包装为使用 await 使用形式,在此基础上可以使用任何 async 库的方法

npm npm npm

GitHub forks GitHub stars

Installation

npm install await-async-flow

Example

const async = require('await-async-flow');
const sleepOneSecond = () => {
  return new Promise((resolve, reject) => {
    setTimeout(() => {
      resolve(Math.random().toFixed(2));
    }, 1000);
  });
};

const ret = await async.parallel({
  a: async () => {
    return await sleepOneSecond();
  },
  b: async () => {
    return await sleepOneSecond();
  }
});

// { a: '0.97', b: '0.94' }

// or

const ret = await async.map([200, 400, 600], async (t) => {
  return await sleep(t);
});

// [ '0.82', '0.45', '0.69' ]

Keywords

FAQs

Package last updated on 21 Jun 2018

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc