Skip to content

Conversation

easymikey
Copy link
Contributor

Fix #2

  • Tests

@easymikey
Copy link
Contributor Author

@antongolub Look like it's time

Copy link
Member

@antongolub antongolub left a comment

Choose a reason for hiding this comment

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

Add nodejs v7 to test matrix

const Q2 = "'" // single quote
const Q3 = '`' // backtick

const utf8Decoder = new TextDecoder('utf-8')
Copy link
Member

@antongolub antongolub Jan 10, 2025

Choose a reason for hiding this comment

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

const {decode} = new TextDecoder('utf-8')

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It won't work that way and I don't want to bind

TypeError [ERR_INVALID_THIS]: Value of "this" must be of type TextDecoder

}

for (const c of content.toString().replace(/\r\n?/mg, '\n')) {
for (const c of bufToString(content).toString().replace(/\r\n?/mg, '\n')) {
Copy link
Member

@antongolub antongolub Jan 10, 2025

Choose a reason for hiding this comment

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

for (const c of (typeof content === 'string' ? content : decode(content))) {

Copy link
Contributor Author

Choose a reason for hiding this comment

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

UP

JSONSTR='{"foo": "b a r"}'`
)
})
test("works with buffer with different encoding", () => {
Copy link
Member

Choose a reason for hiding this comment

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

To verbose. Check typecast, not all cases. FOO=BAR\r\nBAZ=QUZ is enough

@easymikey easymikey force-pushed the feat-proccessing-buffers branch from 77e8d2b to 97cf634 Compare January 10, 2025 11:24
@easymikey easymikey force-pushed the feat-proccessing-buffers branch from 97cf634 to 5d0d111 Compare January 10, 2025 11:26
@antongolub antongolub changed the title refactor: samantic proccesing of buffer perf: optimize buffer input processing Jan 10, 2025
@antongolub antongolub merged commit a057e38 into webpod:main Jan 10, 2025
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

feat: improve handling string or buffer
2 participants