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

iterama

Package Overview
Dependencies
Maintainers
3
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

iterama

Composable functional (async) iterable helpers

  • 0.5.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
55K
decreased by-65%
Maintainers
3
Weekly downloads
 
Created

What is iterama?

Iterama is a utility library for working with iterables in JavaScript. It provides a variety of functions to create, transform, and consume iterables, making it easier to work with sequences of data in a functional programming style.

What are iterama's main functionalities?

Creating Iterables

The `range` function creates an iterable that generates numbers within a specified range. In this example, it generates numbers from 1 to 4.

const { range } = require('iterama');

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

Transforming Iterables

The `map` function transforms each element of an iterable using a provided function. In this example, it doubles each number in the iterable.

const { map } = require('iterama');

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

Consuming Iterables

The `reduce` function consumes an iterable to produce a single value by applying a reducer function. In this example, it calculates the sum of the numbers in the iterable.

const { reduce } = require('iterama');

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

Other packages similar to iterama

Keywords

FAQs

Package last updated on 14 Aug 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

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