MCPcopy Index your code
hub / github.com/SocketCluster/socketcluster / getLens

Function getLens

app/public/socketcluster-client.js:2484–2501  ·  view source on GitHub ↗
(b64)

Source from the content-addressed store, hash-verified

2482revLookup['_'.charCodeAt(0)] = 63
2483
2484function getLens (b64) {
2485 var len = b64.length
2486
2487 if (len % 4 > 0) {
2488 throw new Error('Invalid string. Length must be a multiple of 4')
2489 }
2490
2491 // Trim off extra bytes after placeholder bytes are found
2492 // See: https://github.com/beatgammit/base64-js/issues/42
2493 var validLen = b64.indexOf('=')
2494 if (validLen === -1) validLen = len
2495
2496 var placeHoldersLen = validLen === len
2497 ? 0
2498 : 4 - (validLen % 4)
2499
2500 return [validLen, placeHoldersLen]
2501}
2502
2503// base64 is 4/3 + up to two characters of the original data
2504function byteLength (b64) {

Callers 2

byteLengthFunction · 0.85
toByteArrayFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…