diff --git a/lib/node_modules/@stdlib/string/prev-grapheme-cluster-break/lib/main.js b/lib/node_modules/@stdlib/string/prev-grapheme-cluster-break/lib/main.js index 5395038e6e4c..7d884ad62e4e 100644 --- a/lib/node_modules/@stdlib/string/prev-grapheme-cluster-break/lib/main.js +++ b/lib/node_modules/@stdlib/string/prev-grapheme-cluster-break/lib/main.js @@ -105,9 +105,6 @@ function prevGraphemeClusterBreak( str, fromIndex ) { for ( i = 1; i <= idx; i++ ) { // If the current character is part of a surrogate pair, move along... if ( hasUTF16SurrogatePairAt( str, i-1 ) ) { - ans = i-2; - breaks.length = 0; - emoji.length = 0; continue; } cp = codePointAt( str, i ); diff --git a/lib/node_modules/@stdlib/string/prev-grapheme-cluster-break/test/test.js b/lib/node_modules/@stdlib/string/prev-grapheme-cluster-break/test/test.js index e0811d476245..bbec778bb251 100644 --- a/lib/node_modules/@stdlib/string/prev-grapheme-cluster-break/test/test.js +++ b/lib/node_modules/@stdlib/string/prev-grapheme-cluster-break/test/test.js @@ -192,6 +192,15 @@ tape( 'the function returns the previous grapheme break position in a specified t.end(); }); +tape( 'the function treats emoji modifier sequences as a single extended grapheme cluster', function test( t ) { + var out; + + out = prevGraphemeClusterBreak( '👉🏿' ); + t.strictEqual( out, -1, 'returns expected value' ); + + t.end(); +}); + tape( 'the function returns zero when the second argument is a negative integer (equivalent to clamping the second argument to zero)', function test( t ) { var out;