find_el_in_array

This package for search an element in array

Usage no npm install needed!

<script type="module">
  import findElInArray from 'https://cdn.skypack.dev/find_el_in_array';
</script>

README

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