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

map-reverse

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-reverse

Apply a function to an array from then end to the beginning.

  • 1.0.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
138
decreased by-98.5%
Maintainers
1
Weekly downloads
 
Created
Source

map-reverse

Build Status

Apply a function to an array from then end to the beginning.

It's may be useful when iterating an array and deleting its elements at the same time.

Install

npm install map-reverse

Usage

Reverse iteration allows you to delete current element from an array when iterating.

var mapReverse = require('map-reverse');

var a = [1, 2, 3, 4, 5, 6, 7];

var b = mapReverse(a, function (item, index) {
    if (item % 2)
        a.splice(index, 1);

    return item;
});

console.log(a);
//[ 2, 4, 6 ]

console.log(b);
//[ 7, 6, 5, 4, 3, 2, 1 ]

Keywords

FAQs

Package last updated on 21 Jan 2016

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