mh-populate
v1.0.2
Published
populate between two array with out loop
Downloads
5
Maintainers
Readme
MH Populate
mhPopulate
A JavaScript Libary which will populate data between arrays with n looping and high performance
Installation
npm install mh-populate
Usage
import * as mhPopulate from 'mh-populate';
let countryArray = [
{'name': 'Afghanistan', 'code': 'AF'},
{'name': 'land Islands', 'code': 'AX'},
{'name': 'Albania', 'code': 'AL'},
{'name': 'Algeria', 'code': 'DZ'},
{'name': 'American Samoa', 'code': 'AS'},
{'name': 'AndorrA', 'code': 'AD'},
.....
];
let codeArray = [
{'lat': '555.555','lng':'555.555','code': 'AF',...},
{'lat': '555.555','lng':'555.555','code': 'AX',...},
{'lat': '555.555','lng':'555.555','code': 'AL'},
{'lat': '555.555','lng':'555.555','code': 'DZ'},
{'lat': '555.555','lng':'555.555','code': 'AS'},
{'lat': '555.555','lng':'555.555','code': 'AD'},
.....
];
mhPopulate(countryArray, codeArray, 'code')
| Attribute |Type|Descripton| |--|--|--| | originalArray | Array|data that include foreign key | | populateArray | Array|populate data| | key | String|foreign key| | populateKey | String|populate key| | isNumber | Boolean|is populate value number, by default false|
Contributing
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.
Please make sure to update tests as appropriate.