• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

LukaJCB / ts-mls / 20546848795

28 Dec 2025 01:15AM UTC coverage: 95.971% (-0.2%) from 96.121%
20546848795

push

github

web-flow
Apply eslint and tsc to test/ as well as src/ (#182)

1233 of 1384 branches covered (89.09%)

Branch coverage included in aggregate %.

2 of 2 new or added lines in 1 file covered. (100.0%)

11 existing lines in 1 file now uncovered.

7152 of 7353 relevant lines covered (97.27%)

44246.48 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

77.97
/src/util/byteArray.ts
1
export function bytesToArrayBuffer(b: Uint8Array): ArrayBuffer {
1✔
2
  if (b.buffer instanceof ArrayBuffer) {
993,833✔
3
    if (b.byteOffset === 0 && b.byteLength === b.buffer.byteLength) {
993,831✔
4
      return b.buffer
978,510✔
5
    }
978,510✔
6
    return b.buffer.slice(b.byteOffset, b.byteOffset + b.byteLength)
15,321✔
7
  } else {
993,833✔
8
    const ab = new ArrayBuffer(b.byteLength)
2✔
9
    const arr = new Uint8Array(ab)
2✔
10
    arr.set(b, 0)
2✔
11
    return ab
2✔
12
  }
2✔
13
}
993,833✔
14

15
export function toBufferSource(b: Uint8Array): BufferSource {
1✔
16
  if (b.buffer instanceof ArrayBuffer) return b as Uint8Array<ArrayBuffer>
341,060✔
17
  const ab = new ArrayBuffer(b.byteLength)
2✔
18
  const arr = new Uint8Array(ab)
2✔
19
  arr.set(b, 0)
2✔
20
  return ab
2✔
21
}
2✔
22

23
export function bytesToBase64(bytes: Uint8Array): string {
1✔
24
  if (typeof Buffer !== "undefined") {
123,619✔
25
    return Buffer.from(bytes).toString("base64")
123,619✔
26
  } else {
123,619!
UNCOV
27
    let binary = ""
×
UNCOV
28
    bytes.forEach((b) => (binary += String.fromCharCode(b)))
×
UNCOV
29
    return globalThis.btoa(binary)
×
UNCOV
30
  }
×
31
}
123,619✔
32

33
export function base64ToBytes(base64: string): Uint8Array {
1✔
34
  if (typeof Buffer !== "undefined") {
102✔
35
    return Uint8Array.from(Buffer.from(base64, "base64"))
102✔
36
  } else {
102!
UNCOV
37
    const binary = globalThis.atob(base64)
×
UNCOV
38
    const bytes = new Uint8Array(binary.length)
×
UNCOV
39
    for (let i = 0; i < binary.length; i++) {
×
UNCOV
40
      bytes[i] = binary.charCodeAt(i)
×
UNCOV
41
    }
×
UNCOV
42
    return bytes
×
UNCOV
43
  }
×
44
}
102✔
45

46
export function concatUint8Arrays(a: Uint8Array, b: Uint8Array): Uint8Array {
1✔
47
  const result = new Uint8Array(a.length + b.length)
938✔
48
  result.set(a, 0)
938✔
49
  result.set(b, a.length)
938✔
50
  return result
938✔
51
}
938✔
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc