import global from '../../global';
/**
* @function general
* @description Test if a given string match at least one of the given regular expressions
*
* @param {String} string String to test
* @param {Object} regexpObject Object with regular expression to test
* @returns Boolean
*/
export default (string, regexpObject) => {
if (string && regexpObject) {
for (const key in regexpObject) { // eslint-disable-line
try {
const regexp = new RegExp(regexpObject[key]);
if (regexp.test(string)) {
return key;
}
} catch (error) {
global.logger.log(error.message);
}
}
}
return false;
};