We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 0b69ac7 commit ae0cfc9Copy full SHA for ae0cfc9
lib/internal/tty.js
@@ -29,10 +29,7 @@ const {
29
StringPrototypeToLowerCase,
30
} = primordials;
31
32
-const {
33
- ERR_INVALID_ARG_TYPE,
34
- ERR_OUT_OF_RANGE
35
-} = require('internal/errors').codes;
+const { validateInteger } = require('internal/validators');
36
37
let OSRelease;
38
@@ -221,13 +218,9 @@ function hasColors(count, env) {
221
218
env = count;
222
219
count = 16;
223
220
} else {
224
- if (typeof count !== 'number') {
225
- throw new ERR_INVALID_ARG_TYPE('count', 'number', count);
226
- }
227
- if (count < 2) {
228
- throw new ERR_OUT_OF_RANGE('count', '>= 2', count);
229
+ validateInteger(count, 'count', 2);
230
}
+
231
return count <= 2 ** getColorDepth(env);
232
233
0 commit comments