diff --git a/package.json b/package.json index b7eb742..a3d06e0 100644 --- a/package.json +++ b/package.json @@ -83,7 +83,5 @@ "dist/test" ] }, - "dependencies": { - "byte-range": "^1.0.0" - } + "dependencies": {} } diff --git a/source/lib/predicates/number.ts b/source/lib/predicates/number.ts index 3833375..3c4bf25 100644 --- a/source/lib/predicates/number.ts +++ b/source/lib/predicates/number.ts @@ -1,5 +1,4 @@ import is from '@sindresorhus/is'; -import byteRange from 'byte-range'; import {Predicate, Context} from './predicate'; export class NumberPredicate extends Predicate { @@ -147,9 +146,12 @@ export class NumberPredicate extends Predicate { * Test a number to be in a valid range for a uint8. */ get uint8() { + const start = 0; + const end = 255; + return this.addValidator({ - message: (value, label) => `Expected ${label} to be an integer in range [${byteRange.uint8[0]}..${byteRange.uint8[1]}], got ${value}`, - validator: value => is.integer(value) && is.inRange(value, [byteRange.uint8[0], byteRange.uint8[1]]) + message: (value, label) => `Expected ${label} to be an integer in range [${start}..${end}], got ${value}`, + validator: value => is.integer(value) && is.inRange(value, [start, end]) }); } }