Last active
June 25, 2018 18:37
-
-
Save abel-masila/b182639de8faf475eebc15cddb4c0c56 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var test = [ | |
{ | |
date_issued: '2018-05-25', | |
transaction_type: 'IMPORT', | |
policy_number: '061/100/001052/2018', | |
open_cover: false, | |
endorsement_number: '', | |
icc: 'ICC-A', | |
insured_name: 'SAYONA STEEL LTD', | |
insured_email: '[email protected]', | |
insured_tin: '103 286 883', | |
intermediary_name: 'MILMAR', | |
intermediary_tin: '100-714-078', | |
goods_category: 'Mineral Products', | |
country_of_origin: 'HK', | |
destination: 'Mwanza Region', | |
conveyance: 'SEA', | |
financier: '', | |
currency_code: 'USD', | |
exchange_rate_used: '2262.37', | |
sum_insured: '23302411', | |
premium: '33935.55', | |
VAT: '5176.609322', | |
unit_of_measure: 'UNITS', | |
quantity: '800', | |
cover_start_date: '2018-05-15' | |
}, | |
{ | |
date_issued: '2018-05-25', | |
transaction_type: 'IMPORT', | |
policy_number: '061/100/001051/2018', | |
open_cover: false, | |
endorsement_number: '', | |
icc: 'ICC-A', | |
insured_name: 'URHOME COMPANY LTD', | |
insured_email: '[email protected]', | |
insured_tin: '132-209-898', | |
intermediary_name: 'MILMAR', | |
intermediary_tin: '100-714-078', | |
goods_category: 'Base Metals And Articles Of Base Metal', | |
country_of_origin: 'CN', | |
destination: 'Dar es Salaam Region', | |
conveyance: 'SEA', | |
financier: '', | |
currency_code: 'USD', | |
exchange_rate_used: '2262.37', | |
sum_insured: '54941202.98', | |
premium: '58821.62', | |
VAT: '8972.789492', | |
unit_of_measure: 'UNITS', | |
quantity: '2792', | |
cover_start_date: '2018-05-15' | |
} | |
]; | |
const checkArray = (test, keys) => { | |
let valid = true; | |
test.map(object => { | |
keys.map(key => { | |
if (!object.hasOwnProperty(key)) { | |
valid = false; | |
} | |
}); | |
}); | |
return valid; | |
}; | |
console.log(checkArray(test, ['VAT', 'currency_code', 'quantity'])); |
geofmureithi-zz
commented
Jun 25, 2018
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment