npm.io
1.0.5 • Published 2 years ago

@andreseloysv/filtermap

Licence
MIT
Version
1.0.5
Deps
0
Size
12 kB
Vulns
0
Weekly
0

filterMap

Transforms an array of elements into a new array of elements based on specified filter and mapping functions.

Installation

npm install @andreseloysv/filtermap

Usage

Javascript

const filterMap = require('@andreseloysv/filtermap')

// Example usage:
const numbers = [1, 2, undefined, 3];
const result = filterAndMap(numbers, x => x < 3, x => `Number: ${x}`);
// result will be ['Number: 1', 'Number: 2']

Typescript

import { filterMap } from '@andreseloysv/filtermap';

const numbers = [1, 2, undefined, 3];
const result = filterAndMap(numbers, x => x < 3, x => `Number: ${x}`);
// result will be ['Number: 1', 'Number: 2']