23
23
24
24
const {
25
25
Object : {
26
- defineProperties,
27
- defineProperty,
28
- setPrototypeOf,
29
- create
26
+ defineProperties : ObjectDefineProperties ,
27
+ defineProperty : ObjectDefineProperty ,
28
+ setPrototypeOf : ObjectSetPrototypeOf ,
29
+ create : ObjectCreate
30
30
} ,
31
31
Math : {
32
- floor,
33
- trunc,
34
- min
32
+ floor : MathFloor ,
33
+ trunc : MathTrunc ,
34
+ min : MathMin
35
35
}
36
36
} = primordials ;
37
37
@@ -101,7 +101,7 @@ FastBuffer.prototype.constructor = Buffer;
101
101
Buffer . prototype = FastBuffer . prototype ;
102
102
addBufferPrototypeMethods ( Buffer . prototype ) ;
103
103
104
- const constants = defineProperties ( { } , {
104
+ const constants = ObjectDefineProperties ( { } , {
105
105
MAX_LENGTH : {
106
106
value : kMaxLength ,
107
107
writable : false ,
@@ -123,7 +123,7 @@ let poolSize, poolOffset, allocPool;
123
123
// do not own the ArrayBuffer allocator. Zero fill is always on in that case.
124
124
const zeroFill = bindingZeroFill || [ 0 ] ;
125
125
126
- const encodingsMap = create ( null ) ;
126
+ const encodingsMap = ObjectCreate ( null ) ;
127
127
for ( let i = 0 ; i < encodings . length ; ++ i )
128
128
encodingsMap [ encodings [ i ] ] = i ;
129
129
@@ -180,7 +180,7 @@ function toInteger(n, defaultVal) {
180
180
if ( ! Number . isNaN ( n ) &&
181
181
n >= Number . MIN_SAFE_INTEGER &&
182
182
n <= Number . MAX_SAFE_INTEGER ) {
183
- return ( ( n % 1 ) === 0 ? n : floor ( n ) ) ;
183
+ return ( ( n % 1 ) === 0 ? n : MathFloor ( n ) ) ;
184
184
}
185
185
return defaultVal ;
186
186
}
@@ -265,7 +265,7 @@ function Buffer(arg, encodingOrOffset, length) {
265
265
return Buffer . from ( arg , encodingOrOffset , length ) ;
266
266
}
267
267
268
- defineProperty ( Buffer , Symbol . species , {
268
+ ObjectDefineProperty ( Buffer , Symbol . species , {
269
269
enumerable : false ,
270
270
configurable : true ,
271
271
get ( ) { return FastBuffer ; }
@@ -323,7 +323,7 @@ const of = (...items) => {
323
323
} ;
324
324
Buffer . of = of ;
325
325
326
- setPrototypeOf ( Buffer , Uint8Array ) ;
326
+ ObjectSetPrototypeOf ( Buffer , Uint8Array ) ;
327
327
328
328
// The 'assertSize' method will remove itself from the callstack when an error
329
329
// occurs. This is done simply to keep the internal details of the
@@ -376,8 +376,8 @@ function SlowBuffer(length) {
376
376
return createUnsafeBuffer ( length ) ;
377
377
}
378
378
379
- setPrototypeOf ( SlowBuffer . prototype , Uint8Array . prototype ) ;
380
- setPrototypeOf ( SlowBuffer , Uint8Array ) ;
379
+ ObjectSetPrototypeOf ( SlowBuffer . prototype , Uint8Array . prototype ) ;
380
+ ObjectSetPrototypeOf ( SlowBuffer , Uint8Array ) ;
381
381
382
382
function allocate ( size ) {
383
383
if ( size <= 0 ) {
@@ -724,15 +724,15 @@ function byteLength(string, encoding) {
724
724
Buffer . byteLength = byteLength ;
725
725
726
726
// For backwards compatibility.
727
- defineProperty ( Buffer . prototype , 'parent' , {
727
+ ObjectDefineProperty ( Buffer . prototype , 'parent' , {
728
728
enumerable : true ,
729
729
get ( ) {
730
730
if ( ! ( this instanceof Buffer ) )
731
731
return undefined ;
732
732
return this . buffer ;
733
733
}
734
734
} ) ;
735
- defineProperty ( Buffer . prototype , 'offset' , {
735
+ ObjectDefineProperty ( Buffer . prototype , 'offset' , {
736
736
enumerable : true ,
737
737
get ( ) {
738
738
if ( ! ( this instanceof Buffer ) )
@@ -801,7 +801,7 @@ let INSPECT_MAX_BYTES = 50;
801
801
// Override how buffers are presented by util.inspect().
802
802
Buffer . prototype [ customInspectSymbol ] = function inspect ( recurseTimes , ctx ) {
803
803
const max = INSPECT_MAX_BYTES ;
804
- const actualMax = min ( max , this . length ) ;
804
+ const actualMax = MathMin ( max , this . length ) ;
805
805
const remaining = this . length - max ;
806
806
let str = this . hexSlice ( 0 , actualMax ) . replace ( / ( .{ 2 } ) / g, '$1 ' ) . trim ( ) ;
807
807
if ( remaining > 0 )
@@ -814,7 +814,7 @@ Buffer.prototype[customInspectSymbol] = function inspect(recurseTimes, ctx) {
814
814
extras = true ;
815
815
obj [ key ] = this [ key ] ;
816
816
return obj ;
817
- } , create ( null ) ) ;
817
+ } , ObjectCreate ( null ) ) ;
818
818
if ( extras ) {
819
819
if ( this . length !== 0 )
820
820
str += ', ' ;
@@ -1054,7 +1054,7 @@ Buffer.prototype.toJSON = function toJSON() {
1054
1054
function adjustOffset ( offset , length ) {
1055
1055
// Use Math.trunc() to convert offset to an integer value that can be larger
1056
1056
// than an Int32. Hence, don't use offset | 0 or similar techniques.
1057
- offset = trunc ( offset ) ;
1057
+ offset = MathTrunc ( offset ) ;
1058
1058
if ( offset === 0 ) {
1059
1059
return 0 ;
1060
1060
}
@@ -1175,7 +1175,7 @@ module.exports = {
1175
1175
kStringMaxLength
1176
1176
} ;
1177
1177
1178
- defineProperties ( module . exports , {
1178
+ ObjectDefineProperties ( module . exports , {
1179
1179
constants : {
1180
1180
configurable : false ,
1181
1181
enumerable : true ,
0 commit comments