New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More

@jitesoft/async-array

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@jitesoft/async-array

Array wrapper with async methods.

1.0.4
latest
73

Supply Chain Security

100

Vulnerability

88

Quality

78

Maintenance

100

License

Version published
Weekly downloads
4
-85.19%
Maintainers
2
Weekly downloads
 
Created

async-array

npm (scoped) Known Vulnerabilities pipeline status coverage report npm Back project

Array wrapper with async methods.

There are multiple ways to use this package:

Static functions

Import the static methods which are possible to use on any array type object:

import {map} from '@jitesoft/async-array';
import {doFunStuffAsync} from './async-functions';

(async () => {
let result = await map(['a', 'b', 'c'], async (value, index, list) => {
  let somethingSomething = await doFunStuffAsync(value);
});
})();

The following methods are available to import directly for usage:

  • every
  • find
  • findIndex
  • forEach
  • forEachSeries
  • map
  • some

AsyncArray class

The AsyncArray class is a class which extends the Array class. All the standard methods that the array class have is available on the AsyncArray. The following methods are overriden to introduce async functionality:

  • .every
  • .find
  • .findIndex
  • .forEach
  • .series
  • .map
  • .some

Convert Array

It's also possible to import the simple async and sync methods directly from the package to convert a normal array into async or async array into normal.

import {sync, async} from '@jitesoft/async-array';

let array = [];       // Array
array = async(array); // AsyncArray
array = sync(array);  // Array

FAQs

Package last updated on 09 Sep 2019

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