We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 2897ef9 commit 22bb2f0Copy full SHA for 22bb2f0
src/lib/isLength.js
@@ -13,13 +13,13 @@ export default function isLength(str, options) {
13
min = arguments[1] || 0;
14
max = arguments[2];
15
}
16
-
+
17
const presentationSequences = str.match(/(\uFE0F|\uFE0E)/g) || [];
18
const surrogatePairs = str.match(/[\uD800-\uDBFF][\uDC00-\uDFFF]/g) || [];
19
const len = str.length - presentationSequences.length - surrogatePairs.length;
20
const isInsideRange = len >= min && (typeof max === 'undefined' || len <= max);
21
22
- if (isInsideRange && Array.isArray(options?.discreteLengths)) {
+ if (isInsideRange && Array.isArray(options?.discreteLengths)){
23
return options.discreteLengths.some(discreteLen => discreteLen === len);
24
25
0 commit comments