Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: refactor truncate string package #1097

Open
wants to merge 18 commits into
base: develop
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Apply suggestions from code review
kgryte authored Nov 10, 2023
commit 976eefae80d7ba768c685444d98182e604bcbcf1
10 changes: 1 addition & 9 deletions lib/node_modules/@stdlib/string/num-code-points/README.md
Original file line number Diff line number Diff line change
@@ -20,7 +20,7 @@ limitations under the License.

# numCodePoints

> Return the number of code points in a string.
> Return the number of Unicode code points in a string.

<section class="usage">

@@ -127,12 +127,6 @@ $ echo -n 'beep\nboop書' | num-code-points -l

<section class="related">

* * *

## See Also

- <span class="package-name">[`@stdlib/string/next-grapheme-cluster-break`][@stdlib/string/next-grapheme-cluster-break]</span><span class="delimiter">: </span><span class="description">return the next extended grapheme cluster break in a string after a specified position.</span>

</section>

<!-- /.related -->
@@ -145,8 +139,6 @@ $ echo -n 'beep\nboop書' | num-code-points -l

<!-- <related-links> -->

[@stdlib/string/next-grapheme-cluster-break]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/string/next-grapheme-cluster-break

<!-- </related-links> -->

</section>
3 changes: 1 addition & 2 deletions lib/node_modules/@stdlib/string/num-code-points/lib/main.js
Original file line number Diff line number Diff line change
@@ -80,8 +80,7 @@ function numCodePoints( str ) {
i += 1; // bump the index to process the next code unit
count += 1;
}
}
else {
} else {
count += 1;
}
}
6 changes: 3 additions & 3 deletions lib/node_modules/@stdlib/string/num-code-points/test/test.js
Original file line number Diff line number Diff line change
@@ -82,7 +82,7 @@ tape( 'the function returns the Unicode aware length of a provided string', func
t.end();
});

tape( 'the function returns the number of grapheme clusters (Unpaired surrogates)', function test( t ) {
tape( 'the function returns the number of code points (surrogates)', function test( t ) {
var out;

out = numCodePoints( '𐒻𐓟' );
@@ -91,8 +91,8 @@ tape( 'the function returns the number of grapheme clusters (Unpaired surrogates
out = numCodePoints( '𐒻' );
t.strictEqual( out, 1, 'returns expected value' );

out = numCodePoints( '\uD800' );
t.strictEqual( out, 0, 'returns expected value' );
out = numCodePoints( '\uD800' ); // trailing unpaired high surrogate
t.strictEqual( out, 1, 'returns expected value' );

t.end();
});