Asynchronously compare two array and check if elements has equal value for specified property and get matched indices. *FOR ANGULAR
-
Run 'npm i array-works'
-
Add module import in app.module.ts in imports array import { ArrayWorksModule } from 'array-works';
-
Inject service in component's constructor constructor(public arrayOps: ArrayWorksService){}
-
Pass two array to compare asynchronously along with object property to match async callFn(){ let data = await this.arrayOps.match_two_array_with_single_property_and_get_matched_indices(this.array1, this.array2, 'city'); console.log('RETURNED DATA', data); }
-
Note: Make sure to include async & await.
To get more help write email @ akashjadhav1221@gmail.com Improve library by adding more common useful array operations: https://github.com/akashjadhav1221/array-works