Skip to content

Commit

Permalink
bytes: fix isBytes check
Browse files Browse the repository at this point in the history
  • Loading branch information
ChALkeR committed Aug 26, 2021
1 parent c41b89a commit af9f4c5
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions packages/bytes/src.ts/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,11 +75,11 @@ export function isBytes(value: any): value is Bytes {

if (value.constructor === Uint8Array) { return true; }
if (typeof(value) === "string") { return false; }
if (value.length == null) { return false; }
if (!Number.isInteger(value.length) || value.length < 0) { return false; }

for (let i = 0; i < value.length; i++) {
const v = value[i];
if (typeof(v) !== "number" || v < 0 || v >= 256 || (v % 1)) {
if (!Number.isInteger(v) || v < 0 || v >= 256) {
return false;
}
}
Expand Down

0 comments on commit af9f4c5

Please sign in to comment.