MCPcopy Index your code
hub / github.com/feross/buffer / utf16leSlice

Function utf16leSlice

index.js:1084–1092  ·  view source on GitHub ↗
(buf, start, end)

Source from the content-addressed store, hash-verified

1082}
1083
1084function utf16leSlice (buf, start, end) {
1085 const bytes = buf.slice(start, end)
1086 let res = ''
1087 // If bytes.length is odd, the last 8 bits must be ignored (same as node.js)
1088 for (let i = 0; i < bytes.length - 1; i += 2) {
1089 res += String.fromCharCode(bytes[i] + (bytes[i + 1] * 256))
1090 }
1091 return res
1092}
1093
1094Buffer.prototype.slice = function slice (start, end) {
1095 const len = this.length

Callers 1

slowToStringFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected