get-filtered

1.0.2 • Public • Published

Description

  • filter an array of object based on an array and a key

Install

npm i get-filtered

Usage

const {getFiltered} = require('getFiltered')

const data = [
    {
        id: 1,
        name: "USA",
        continent: "North America",
        planet: "Earth"
    },
    {
        id: 2,
        name: "Canada",
        planet: "Earth"
    },
    {
        id: 3,
        name: "Haiti",
        continent: "North America",
    }
]

const config = {
    inc: ["Earth"],
    filter_key: "planet"
}

const callback = (f) => {
    console.log(f)
    return f
}
const gotFiltered = getFiltered(data, config, callback)



Readme

Keywords

none

Package Sidebar

Install

npm i get-filtered

Weekly Downloads

0

Version

1.0.2

License

ISC

Unpacked Size

1.8 kB

Total Files

3

Last publish

Collaborators

  • zwazoe