File size: 632 Bytes
1e92f2d | 1 2 3 4 5 6 7 8 9 10 11 12 13 | /**
* Determines if the email account provided i.e. `emailAccount` has one or more warnings with the slug `warningSlug` in its `warnings` array
* @param {string} warningSlug - The warning slug to check against
* @param {Object} emailAccount - The email account being investigated for warnings of a certain slug
* @returns {boolean} Returns true if warnings with the slug are found, false otherwise
*/
export function accountHasWarningWithSlug( warningSlug, emailAccount ) {
const warnings = emailAccount?.warnings;
return ( warnings?.[ 0 ] ? warnings : [] ).some(
( warning ) => warningSlug === warning?.warning_slug
);
}
|