README
Find Element In Array
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
- 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
- Milad E. Fahmy - Initial work - Milad E. Fahmy
License
This project is licensed under the MIT License - see the LICENSE.md file for details