We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent dd18795 commit feaf057Copy full SHA for feaf057
lib/internal/tty.js
@@ -34,6 +34,8 @@ const {
34
ERR_OUT_OF_RANGE
35
} = require('internal/errors').codes;
36
37
+const { validateInteger } = require('internal/validators');
38
+
39
let OSRelease;
40
41
const COLORS_2 = 1;
@@ -220,14 +222,9 @@ function hasColors(count, env) {
220
222
(count === undefined || (typeof count === 'object' && count !== null))) {
221
223
env = count;
224
count = 16;
- } else {
- 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
230
+ } else
+ validateInteger(count, 'count', 2);
231
return count <= 2 ** getColorDepth(env);
232
}
233
0 commit comments