2.0.0 • Published 3 years ago

find_el_in_array v2.0.0

Weekly downloads
2
License
MIT
Repository
github
Last release
3 years ago

Find Element In Array Build Status npm version

search in array

Getting Started

This is an npm package for search in array

Prerequisites

you should have node.js in your local machine

Installing

    npm i find_el_in_array
    
    //OR

    yarn add find_el_in_array

How To Use it

After install package

  1. Examples for simple array:
const FindElementInArray = require('find_el_in_array');

//OR

import FindElementInArray from 'find_el_in_array';


const findElementInArray = new FindElementInArray();

//simple array
    const testArray = [
      'milad', 'ezzat', 'fahmy', 1, 5, 8,
    ];
    const searchItem = 8;

const result = findElementInArray.searchInSimpleArray(testArray, searchItem);
// return 8

// complex array

  const testArray = [
    { id: 1, name: 'milad', age: 24 },
    { id: 2, name: 'ezzat', age: 24 },
    { id: 4, name: 'Milad', age: 24 },
    { id: 3, name: 'Fahym', age: 24 },
  ];
const result = searchInArray.searchInComplexArray(testArray, 'id', 4);
// return { id: 4, name: 'Milad', age: 24 }

Authors

License

This project is licensed under the MIT License - see the LICENSE.md file for details