Say I have the following code:
const isArrayField = type => !!type.match(/^Array\[\w+\]$/);
const type = 'Array[IncidentRole]';
console.log(isArrayField(type));
All I need to know is if the string matched the regex. I don’t need the matches. In this case, is it safe to use !! to force isArrayField
to return a boolean? If not, why?