Skip to content

Commit

Permalink
bytesEqual util
Browse files Browse the repository at this point in the history
  • Loading branch information
polymorpher committed Jun 18, 2021
1 parent 7bacc29 commit ae1b113
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions code/lib/util.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,14 @@ const utils = {
return hexStr.startsWith('0x') ? utils.hexToBytes(hexStr.slice(2), length) : utils.hexToBytes(hexStr, length)
},

bytesEqual: (b1, b2) => {
if (b1.byteLength !== b2.byteLength) return false
for (let i = 0; i < b1.byteLength; i++) {
if (b1[i] !== b2[i]) return false
}
return true
},

timeToIndex: ({
effectiveTime,
time = Date.now(),
Expand Down

0 comments on commit ae1b113

Please sign in to comment.