diff --git a/src/lib/isLength.js b/src/lib/isLength.js index 6f8d90aaf..3ca7d339c 100644 --- a/src/lib/isLength.js +++ b/src/lib/isLength.js @@ -13,13 +13,13 @@ export default function isLength(str, options) { min = arguments[1] || 0; max = arguments[2]; } - + const presentationSequences = str.match(/(\uFE0F|\uFE0E)/g) || []; const surrogatePairs = str.match(/[\uD800-\uDBFF][\uDC00-\uDFFF]/g) || []; const len = str.length - presentationSequences.length - surrogatePairs.length; const isInsideRange = len >= min && (typeof max === 'undefined' || len <= max); - if (isInsideRange && Array.isArray(options?.discreteLengths)) { + if (isInsideRange && Array.isArray(options?.discreteLengths)){ return options.discreteLengths.some(discreteLen => discreteLen === len); }