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

array-map-slice

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

array-map-slice

Allows to map a slice of the array for each item in the array.

0.1.0
latest
Source
npm
Version published
Maintainers
1
Created
Source

array-map-slice Build Status

Allows to map a slice of the array for each item in the array.

Usage

const mapSlice = require('array-map-slice');

mapSlice([ 1, 2, 3 ], (slice, index, array) => {
    return slice.join('-');
});
// => [ '1', '1-2', '1-2-3' ]

Or if you want to create slices from the right use mapSliceRight:

const mapSlice = require('array-map-slice');

mapSlice.mapSliceRight([ 1, 2, 3 ], (slice, index, array) => {
    return slice.join('-');
});
// => [ '1-2-3', '2-3', '3' ]

Installation

npm install array-map-slice

API

mapSlice(input, mapper) / mapSliceRight(input, mapper)

Returns a new array with values returned by the mapper function.

input

Type: Array

Iterated over in the mapper function which gets splices of it.

mapper (slice, index, array)

Type: Function

Executed for every slice and expected to return the new value.

License

MIT © Florian Goße

Keywords

array

FAQs

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