File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11'use strict' ;
22
33const util = require ( 'util' ) ;
4+ const assert = require ( 'assert' ) ;
45
56function Console ( stdout , stderr ) {
67 if ( ! ( this instanceof Console ) ) {
@@ -83,8 +84,11 @@ Console.prototype.trace = function trace() {
8384
8485Console . prototype . assert = function ( expression ) {
8586 if ( ! expression ) {
86- var arr = Array . prototype . slice . call ( arguments , 1 ) ;
87- require ( 'assert' ) . ok ( false , util . format . apply ( this , arr ) ) ;
87+ var argsleft = arguments . length - 1 ;
88+ const arr = new Array ( argsleft > 0 ? argsleft : 0 ) ;
89+ while ( argsleft -- > 0 ) arr [ argsleft ] = arguments [ argsleft + 1 ] ;
90+
91+ assert . ok ( false , util . format . apply ( this , arr ) ) ;
8892 }
8993} ;
9094
Original file line number Diff line number Diff line change @@ -185,14 +185,13 @@ win32.isAbsolute = function(path) {
185185} ;
186186
187187win32 . join = function ( ) {
188- function f ( p ) {
189- if ( typeof p !== 'string' ) {
190- throw new TypeError ( 'Arguments to path.join must be strings' ) ;
191- }
192- return p ;
188+ const paths = new Array ( arguments . length ) ;
189+ for ( var i = 0 ; i < arguments . length ; i ++ ) {
190+ if ( typeof arguments [ i ] !== 'string' ) {
191+ throw new TypeError ( 'Arguments to path.join must be strings' ) ;
192+ }
193+ paths [ i ] = arguments [ i ] ;
193194 }
194-
195- var paths = Array . prototype . filter . call ( arguments , f ) ;
196195 var joined = paths . join ( '\\' ) ;
197196
198197 // Make sure that the joined path doesn't start with two slashes, because
Original file line number Diff line number Diff line change @@ -15,8 +15,11 @@ exports.format = function(f) {
1515
1616 if ( arguments . length === 1 ) return f ;
1717
18+ var argsleft = arguments . length ;
19+ const args = new Array ( argsleft ) ;
20+ while ( argsleft -- ) args [ argsleft ] = arguments [ argsleft ] ;
21+
1822 var i = 1 ;
19- var args = arguments ;
2023 var len = args . length ;
2124 var str = String ( f ) . replace ( formatRegExp , function ( x ) {
2225 if ( x === '%%' ) return '%' ;
You can’t perform that action at this time.
0 commit comments