"use strict";var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:true});exports.default=void 0;var _asyncToGenerator2=_interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));var _default=function(){var _ref=(0,_asyncToGenerator2.default)(function*(map,exec,callback){
return new Promise(function(){var _ref2=(0,_asyncToGenerator2.default)(function*(resolve,reject){
if(!map){
return reject("array is not provided");
}
if(!exec&&typeof exec=="function"){
return reject("exec is not provided/valid");
}
try{
const keys=Object.keys(map);
const values=Object.values(map);

for(let index=0;index<keys.length;index++){
const key=keys[index];
const value=values[index];

yield exec(key,value);

if(index==keys.length-1){
if(typeof callback!=="undefined"){
callback(false,true);
}
return resolve();
}

}
}catch(error){
if(typeof callback!=="undefined"){
callback(error,false);
}
return reject(error);
}
});return function(_x4,_x5){return _ref2.apply(this,arguments)}}());
});return function(_x,_x2,_x3){return _ref.apply(this,arguments)}}();exports.default=_default;