buffer: add isLatin1 - #66298
buffer: add isLatin1#66298jasnell wants to merge 1 commit into
Conversation
|
Review requested:
|
|
I don't think |
|
Yeah, I'm going to rename to |
5826c3c to
98b8ffc
Compare
98b8ffc to
07f71ca
Compare
07f71ca to
090b087
Compare
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #66298 +/- ##
==========================================
- Coverage 90.37% 90.36% -0.02%
==========================================
Files 792 792
Lines 275324 275344 +20
Branches 52764 52760 -4
==========================================
- Hits 248828 248805 -23
- Misses 16918 16973 +55
+ Partials 9578 9566 -12
🚀 New features to boost your workflow:
|
addaleax
left a comment
There was a problem hiding this comment.
isLatin1String would be much better naming because it describes what the method actually tests for. The WebIDL ByteString type describes a legacy type that stems from the lack of commitment to a specific encoding in early HTTP versions other than vague ASCII backwards compatibility, and it's not actually used widely outside of HTTP-specific APIs for that (very good) reason.
I don't think
isLatin1is a good name,\u0100can definitely be a 2-byte latin1 string
This is not a statement that makes sense, \u0100 cannot be represented in Latin-1, and there are, by definition, no 2-byte Latin-1 strings to begin with -- maybe you're referring to the idea that the byte sequence 01 00 can be Latin-1, but this method takes a string as an argument, i.e. a character sequence, not a byte sequence
|
The challenge with |
Without knowledge of the V8
That's a fair point, although in the context of Node.js APIs, |
|
Fair... ok... renaming it back to And if @aduh95 disagrees we'll have you both play rock/paper/scissors at nodeconf to decide. |
090b087 to
67b095c
Compare
Implements a fast check to determine if a string is a valid byte string (only chars <= 0xff). Signed-off-by: James M Snell <jasnell@gmail.com>
67b095c to
799740c
Compare
|
Typings added. If you can give it another stamp I'd appreciate it. |
Implements a fast check to determine if a string is
Latin1a byte stringLatin1.Can be many times faster than the equivalent regex check.
(the larger perf gap there is with concatenated strings)