File tree Expand file tree Collapse file tree 1 file changed +1
-10
lines changed
Expand file tree Collapse file tree 1 file changed +1
-10
lines changed Original file line number Diff line number Diff line change @@ -47,14 +47,8 @@ function alignPool() {
4747
4848function Buffer ( arg , encodingOrOffset , length ) {
4949 // Common case.
50- if ( typeof arg === 'number' ) {
51- if ( typeof encodingOrOffset === 'string' ) {
52- throw new Error (
53- 'If encoding is specified then the first argument must be a string'
54- ) ;
55- }
50+ if ( typeof arg === 'number' )
5651 return Buffer . allocUnsafe ( arg ) ;
57- }
5852 return Buffer . from ( arg , encodingOrOffset , length ) ;
5953}
6054
@@ -155,9 +149,6 @@ function fromString(string, encoding) {
155149 if ( typeof encoding !== 'string' || encoding === '' )
156150 encoding = 'utf8' ;
157151
158- if ( ! Buffer . isEncoding ( encoding ) )
159- throw new TypeError ( '"encoding" must be a valid string encoding' ) ;
160-
161152 var length = byteLength ( string , encoding ) ;
162153 if ( length >= ( Buffer . poolSize >>> 1 ) )
163154 return binding . createFromString ( string , encoding ) ;
You can’t perform that action at this time.
0 commit comments