MCPcopy Create free account
hub / github.com/OneNoteDev/WebClipper / utf16leToBytes

Function utf16leToBytes

lib/sanitize-html.js:2353–2367  ·  view source on GitHub ↗
(str, units)

Source from the content-addressed store, hash-verified

2351}
2352
2353function utf16leToBytes (str, units) {
2354 var c, hi, lo
2355 var byteArray = []
2356 for (var i = 0; i < str.length; ++i) {
2357 if ((units -= 2) < 0) break
2358
2359 c = str.charCodeAt(i)
2360 hi = c >> 8
2361 lo = c % 256
2362 byteArray.push(lo)
2363 byteArray.push(hi)
2364 }
2365
2366 return byteArray
2367}
2368
2369function base64ToBytes (str) {
2370 return base64.toByteArray(base64clean(str))

Callers 1

ucs2WriteFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected