import global from '../../global';
/**
* @function isValid
* @description Test if a given string match the given regular expression
*
* @param {String} string String to test
* @param {String} regexpValue regular expression to test
* @returns Boolean
*/
export default (string, regexpValue) => {
if (string && regexpValue) {
try {
const regexp = new RegExp(regexpValue);
if (regexp.test(string)) {
return true;
}
} catch (error) {
global.logger.warn(error.message);
}
}
return false;
};