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

Implement node.js buffer.isAscii|isUtf8 #2281

Merged
merged 1 commit into from
Jun 18, 2024

Conversation

jasnell
Copy link
Member

@jasnell jasnell commented Jun 17, 2024

This change adds two new methods to the node.js Buffer class: isAscii and isUtf8. These methods are used to check if the buffer contains only ASCII or UTF-8 characters, respectively.

The implementation of these methods is based on the simdutf library, just like in Node.js itself. (the dependency will be used for other things too... this is just the first thing)

Copy link
Collaborator

@IgorMinar IgorMinar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

one q, but the rest of JS/public API surface part of this PR looks good to me. Thanks @jasnell!

src/workerd/api/node/buffer.h Show resolved Hide resolved
@jasnell jasnell force-pushed the jsnell/node-buffer-is-ascii-utf8 branch from c72e6ce to de35a1d Compare June 17, 2024 23:20
src/workerd/api/node/buffer.c++ Outdated Show resolved Hide resolved
This change adds two new methods to the node.js Buffer class:
isAscii and isUtf8. These methods are used to check if the buffer
contains only ASCII or UTF-8 characters, respectively.

The implementation of these methods is based on the simdutf library,
just like in Node.js itself.
@jasnell jasnell force-pushed the jsnell/node-buffer-is-ascii-utf8 branch from de35a1d to c2648e0 Compare June 18, 2024 17:13
@jasnell jasnell merged commit 92c30c9 into main Jun 18, 2024
10 checks passed
@jasnell jasnell deleted the jsnell/node-buffer-is-ascii-utf8 branch June 18, 2024 17:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants