File tree Expand file tree Collapse file tree 1 file changed +4
-12
lines changed
Expand file tree Collapse file tree 1 file changed +4
-12
lines changed Original file line number Diff line number Diff line change @@ -29,10 +29,7 @@ const {
2929 StringPrototypeToLowerCase,
3030} = primordials ;
3131
32- const {
33- ERR_INVALID_ARG_TYPE ,
34- ERR_OUT_OF_RANGE
35- } = require ( 'internal/errors' ) . codes ;
32+ const { validateInteger } = require ( 'internal/validators' ) ;
3633
3734let OSRelease ;
3835
@@ -220,14 +217,9 @@ function hasColors(count, env) {
220217 ( count === undefined || ( typeof count === 'object' && count !== null ) ) ) {
221218 env = count ;
222219 count = 16 ;
223- } 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- }
230- }
220+ } else
221+ validateInteger ( count , 'count' , 2 ) ;
222+
231223 return count <= 2 ** getColorDepth ( env ) ;
232224}
233225
You can’t perform that action at this time.
0 commit comments