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

array-generators

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

array-generators

Array functions (forEach, filter, map) with support for generator functions

  • 1.1.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

array-generators Circle CI

Array methods (forEach, forEachSeries, map, filter) with support for generator functions.

Installation

$ npm install array-generators --save

Usage

let array = require('array-generators');

let forEach = array.forEach;
let filter = array.filter;
let map = array.map;

let arr = ['first', 'second', 'third'];


/* forEach (async) */
yield forEach(arr, function * (item, index) {
	// item is value, e.g. 'first'
	// index is, well, index, e.g. 0
});


/* forEachSeries (serially) */
yield forEachSeries(arr, function * (item, index) {
  // same as forEach()
});

/* filter */
let result = yield filter(arr, function * (item, index) {
	// return true or false
});


/* map */
let result = yield map(arr, function * (item, index) {
	// return value
});

Tests

Circle CI

$ make test

License

MIT © Vadym Demedes

Keywords

FAQs

Package last updated on 06 Sep 2015

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