permission protocol + reduce circular dependencies

This commit is contained in:
Kevin Jahns
2018-12-11 19:49:21 +01:00
parent e09ef15349
commit 04066a5678
29 changed files with 380 additions and 213 deletions

View File

@@ -148,6 +148,21 @@ export const readVarUint = decoder => {
}
}
/**
* Look ahead and read varUint without incrementing position
*
* @function
* @param {Decoder} decoder
* @return {number}
*/
export const peekVarUint = decoder => {
let pos = decoder.pos
let s = readVarUint(decoder)
decoder.pos = pos
return s
}
/**
* Read string of variable length
* * varUint is used to store the length of the string
@@ -189,3 +204,4 @@ export const peekVarString = decoder => {
decoder.pos = pos
return s
}