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

map-iter

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

map-iter

Applies a callback to each value outputted by an iterable.

  • 1.0.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
1.7K
decreased by-17.71%
Maintainers
1
Weekly downloads
 
Created
Source

map-iter

Applies a callback to each value outputted by an iterable.

Installation

Requires Node.js 6.0.0 or above.

npm i map-iter

API

The module exports a single function.

Parameters

  1. iter (iterable)
  2. cb (function): The callback that, for each value iterated by iter, will be given two arguments: the value iterated, and an incrementing index counter that starts at zero. The return value of cb will be iterated in lieu of the original value.

Return Value

An iterator that outputs the return values of cb.

Example

const map = require('map-iter')

const iterator = map([1, 2, 3], x => x * 2)
iterator.next().value // 2
iterator.next().value // 4
iterator.next().value // 6
iterator.next().done // true
  • filter-iter: Filters an iterable object so that it only yields values which pass a test function.
  • partition-iterable: Divides iterated values into those that match a filter and those that don’t.
  • reduce-iterable: Applies a function to iterated values to reduce them to a single value.
  • unique-iterable: Filters an iterable object so it doesn’t yield the same value more than once.
  • unique-iterable-by: Filters yielded values by testing uniqueness with an index, key, or callback.
  • @lamansky/every: Array.prototype.every() for iterables.
  • @lamansky/some: Array.prototype.some() for iterables.

Keywords

FAQs

Package last updated on 22 Aug 2018

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