New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

first-mapped

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

first-mapped

Returns the first truthy mapping of elements in an array

latest
npmnpm
Version
0.2.0
Version published
Weekly downloads
6
200%
Maintainers
1
Weekly downloads
 
Created
Source

first-mapped

Returns the first truthy mapping of elements in an array.

It's a very small package that implements a pattern I kept seeing.

It's much like Array.find except it returns the value computed instead of the element that it's computed from

Installation

npm install --save first-mapped

Usage

const firstMapped = require('first-mapped')

let mapped = firstMapped([1, 2, 3], (val, index, arr) => {
  if (val === 3) {
    return 'HERE'
  } else {
    return false
  }
})

console.log(mapped) // HERE 

Keywords

map

FAQs

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