🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
DemoInstallSign in
Socket

iterare

Package Overview
Dependencies
Maintainers
1
Versions
15
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

iterare

Array methods for ES6 Iterators

1.2.1
latest
Source
npm
Version published
Weekly downloads
4.2M
-4.35%
Maintainers
1
Weekly downloads
 
Created

What is iterare?

The iterare npm package provides a set of utilities for working with iterables in JavaScript. It allows you to create, transform, and consume iterables in a functional programming style.

What are iterare's main functionalities?

Creating Iterables

You can create an iterable from an array or any other iterable object using the `iterate` function.

const { iterate } = require('iterare');

const iterable = iterate([1, 2, 3, 4]);
console.log([...iterable]); // Output: [1, 2, 3, 4]

Transforming Iterables

You can transform iterables using methods like `map` and `filter` to apply functions to each element or filter elements based on a condition.

const { iterate } = require('iterare');

const iterable = iterate([1, 2, 3, 4])
  .map(x => x * 2)
  .filter(x => x > 4);
console.log([...iterable]); // Output: [6, 8]

Consuming Iterables

You can consume iterables using methods like `reduce` to aggregate values or perform other operations that consume the iterable.

const { iterate } = require('iterare');

const iterable = iterate([1, 2, 3, 4]);
const sum = iterable.reduce((acc, val) => acc + val, 0);
console.log(sum); // Output: 10

Other packages similar to iterare

Keywords

iterator

FAQs

Package last updated on 06 Jun 2020

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