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

map-iterable

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

map-iterable

Array.prototype.map analog for iterables.

  • 2.0.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

map-iterable

Greenkeeper badge

Array.prototype.map analog for iterables.

Travis Build Status NPM module NPM downloads

The map() method creates a new iterable with the results of calling a provided function on every element in given iterable.

You can omit the data argument and you get a function that map over the provided function.

Installation

npm install --save map-iterable

Examples

const map = require("map-iterable");
const numbers = [1, 4, 9];
const roots = Array.from(map(Math.sqrt, numbers));
// roots is now [1, 2, 3], numbers is still [1, 4, 9]

using partial apply

const map = require("map-iterable");
const mapSqrt = map(Math.sqrt);
const numbers = [1, 4, 9];
cons;
const roots = Array.from(mapSqrt(numbers));
// roots is now [1, 2, 3], numbers is still [1, 4, 9]

API

map

Creates a new iterable with the results of calling transform function on every element in data iterable. If you omit the data argument return a unary function that accept the data argument and map over the provided function.

Parameters

  • transform Function a function that return an element of the new Iterable, receiving as arguments: . currentValue - The current element being processed in the iterable. index - The index of the current element being processed in the iterable.
  • data Iterable The source iterable to iterate over.

Returns Iterable A new Iterable over results of the transform function.

License

The MIT License (MIT)

© 2017 Andrea Parodi

Keywords

FAQs

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