@@ -52,9 +52,7 @@ function _mask(source, mask, output, offset, length) {
52
52
* @public
53
53
*/
54
54
function _unmask ( buffer , mask ) {
55
- // Required until https://github.com/nodejs/node/issues/9006 is resolved.
56
- const length = buffer . length ;
57
- for ( let i = 0 ; i < length ; i ++ ) {
55
+ for ( let i = 0 ; i < buffer . length ; i ++ ) {
58
56
buffer [ i ] ^= mask [ i & 3 ] ;
59
57
}
60
58
}
@@ -103,19 +101,18 @@ function toBuffer(data) {
103
101
104
102
try {
105
103
const bufferUtil = require ( 'bufferutil' ) ;
106
- const bu = bufferUtil . BufferUtil || bufferUtil ;
107
104
108
105
module . exports = {
109
106
concat,
110
107
mask ( source , mask , output , offset , length ) {
111
108
if ( length < 48 ) _mask ( source , mask , output , offset , length ) ;
112
- else bu . mask ( source , mask , output , offset , length ) ;
109
+ else bufferUtil . mask ( source , mask , output , offset , length ) ;
113
110
} ,
114
111
toArrayBuffer,
115
112
toBuffer,
116
113
unmask ( buffer , mask ) {
117
114
if ( buffer . length < 32 ) _unmask ( buffer , mask ) ;
118
- else bu . unmask ( buffer , mask ) ;
115
+ else bufferUtil . unmask ( buffer , mask ) ;
119
116
}
120
117
} ;
121
118
} catch ( e ) /* istanbul ignore next */ {
0 commit comments