1.0.2 • Published 3 years ago

gxi-search-array v1.0.2

Weekly downloads
5
License
ISC
Repository
github
Last release
3 years ago

Introduction

Get exact searched value from any type of array.

Installation

npm install gxi-search-array --save

Usage

import SearchedArray from 'gxi-search-array'

const students = [
    {
        name: 'John Smith',
        age: 15,
        sports: [
            {
                id: 1,
                name: 'Football'
            },
            {
                id: 4,
                name: 'Cricket'
            }
        ]
    },
    {
        name: 'Miller',
        age: 16,
        sports: [
            {
                id: 1,
                name: 'Football'
            }
        ]
    }
];

const searched = SearchedArray(students, 'Cricket');
console.log(searched)
/*
[
    {
        name: 'John Smith',
            age: 15,
            sports: [
            {
                id: 1,
                name: 'Football'
            },
            {
                id: 4,
                name: 'Cricket'
            }
        ]
    }
]

*/