This repository was archived by the owner on Aug 31, 2018. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +11
-8
lines changed Expand file tree Collapse file tree 2 files changed +11
-8
lines changed Original file line number Diff line number Diff line change @@ -271,6 +271,13 @@ function join(output, separator) {
271271 return str ;
272272}
273273
274+ // About 1.5x faster than the two-arg version of Array#splice().
275+ function spliceOne ( list , index ) {
276+ for ( var i = index , k = i + 1 , n = list . length ; k < n ; i += 1 , k += 1 )
277+ list [ i ] = list [ k ] ;
278+ list . pop ( ) ;
279+ }
280+
274281module . exports = {
275282 assertCrypto,
276283 cachedResult,
@@ -281,10 +288,11 @@ module.exports = {
281288 filterDuplicateStrings,
282289 getConstructorOf,
283290 isError,
291+ join,
284292 normalizeEncoding,
285293 objectToString,
286294 promisify,
287- join ,
295+ spliceOne ,
288296
289297 // Symbol used to customize promisify conversion
290298 customPromisifyArgs : kCustomPromisifyArgsSymbol ,
Original file line number Diff line number Diff line change @@ -28,6 +28,8 @@ const { hexTable } = require('internal/querystring');
2828
2929const errors = require ( 'internal/errors' ) ;
3030
31+ const { spliceOne } = require ( 'internal/util' ) ;
32+
3133// WHATWG URL implementation provided by internal/url
3234const {
3335 URL ,
@@ -950,13 +952,6 @@ Url.prototype.parseHost = function parseHost() {
950952 if ( host ) this . hostname = host ;
951953} ;
952954
953- // About 1.5x faster than the two-arg version of Array#splice().
954- function spliceOne ( list , index ) {
955- for ( var i = index , k = i + 1 , n = list . length ; k < n ; i += 1 , k += 1 )
956- list [ i ] = list [ k ] ;
957- list . pop ( ) ;
958- }
959-
960955// These characters do not need escaping:
961956// ! - . _ ~
962957// ' ( ) * :
You can’t perform that action at this time.
0 commit comments