mirror of
https://github.com/QwenLM/qwen-code.git
synced 2026-05-05 07:10:55 +00:00
refactor: use for...of loop instead of traditional for loop (#1840)
This commit is contained in:
parent
fc21d1cae3
commit
e188daab91
2 changed files with 10 additions and 10 deletions
|
|
@ -34,10 +34,10 @@ export function isBinary(
|
|||
|
||||
const sample = data.length > sampleSize ? data.subarray(0, sampleSize) : data;
|
||||
|
||||
for (let i = 0; i < sample.length; i++) {
|
||||
for (const byte of sample) {
|
||||
// The presence of a NULL byte (0x00) is one of the most reliable
|
||||
// indicators of a binary file. Text files should not contain them.
|
||||
if (sample[i] === 0) {
|
||||
if (byte === 0) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue