1.0.7 • Published 1 year ago

filter-and-map v1.0.7

Weekly downloads
-
License
ISC
Repository
github
Last release
1 year ago

filter-and-map

Installation

npm install filter-and-map

Usage

In your code's entry point (usually index.* or main.*), include the following line:

import 'filter-and-map';

You should now have access to Array.prototype.filterAndMap throughout the entirety of your code.

Array.prototype.filterAndMap

The Array.prototype.filterAndMap method can be used like so:

const example = [
    { id: 1, isValid: true, name: "Bret" },
    { id: 2, isValid: false, name: "Gary" },
    { id: 3, isValid: true, name: "Shafran" }
]

const result = example.filterAndMap((item) => {
    if (item.isValid) return item.name;
});

// or we could write:
const result = example.filterAndMap((item) => item.isValid ? item.name : undefined);
1.0.7

1 year ago

1.0.6

1 year ago

1.0.5

1 year ago

1.0.4

1 year ago

1.0.3

1 year ago

1.0.2

1 year ago

1.0.1

1 year ago

1.0.0

1 year ago