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

dark-aigle

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

dark-aigle

Dark Aigle extends a native Promise or a promise library to have useful functions using dark power

  • 0.1.0
  • latest
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

Dark-Aigle

Dark Aigle has dark power.

The library extends a native Promise or a Promise library to have Aigle functions.

It is mainly used for a native Promise because of Async/Await restrictuion. See Example.

Usage

You just need to call this library somewhere. The Promise will be extended.

require('dark-aigle')(Promise);

Example

async function executeAsyncTask() {
  await new Promise(resolve => setTimeout(resolve));
}

async function getArray() {
  await executeAsyncTask();
  return [1, 2, 3];
}

async function filterIterator(num) {
  await executeAsyncTask();
  return num % 2 === 1;
}

async function mapIterator(num) {
  await executeAsyncTask();
  return num * 2;
}
test();

async function test() {
  const array = await getArray();
  const boolList = await Promise.all(array.map(filterIterator));
  const filtered = array.filter((n, i) => boolList[i]);
  const result = await Promise.all(filtered.map(mapIterator));
  console.log(result); // [2, 6]
}

If you use the library, you can make it simple and readable.

requrie('dark-aigle')(Promise);

test();

async function test() {
  const result = await getArray()
    .filter(filterIterator)
    .map(mapIterator);
  console.log(result); // [2, 6]
}

Keywords

FAQs

Package last updated on 20 Nov 2017

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