File tree 3 files changed +16
-10
lines changed
3 files changed +16
-10
lines changed Original file line number Diff line number Diff line change 1
1
'use strict' ;
2
2
3
3
const util = require ( 'util' ) ;
4
+ const assert = require ( 'assert' ) ;
4
5
5
6
function Console ( stdout , stderr ) {
6
7
if ( ! ( this instanceof Console ) ) {
@@ -83,8 +84,11 @@ Console.prototype.trace = function trace() {
83
84
84
85
Console . prototype . assert = function ( expression ) {
85
86
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 ) ) ;
88
92
}
89
93
} ;
90
94
Original file line number Diff line number Diff line change @@ -185,14 +185,13 @@ win32.isAbsolute = function(path) {
185
185
} ;
186
186
187
187
win32 . 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 ] ;
193
194
}
194
-
195
- var paths = Array . prototype . filter . call ( arguments , f ) ;
196
195
var joined = paths . join ( '\\' ) ;
197
196
198
197
// 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) {
15
15
16
16
if ( arguments . length === 1 ) return f ;
17
17
18
+ var argsleft = arguments . length ;
19
+ const args = new Array ( argsleft ) ;
20
+ while ( argsleft -- ) args [ argsleft ] = arguments [ argsleft ] ;
21
+
18
22
var i = 1 ;
19
- var args = arguments ;
20
23
var len = args . length ;
21
24
var str = String ( f ) . replace ( formatRegExp , function ( x ) {
22
25
if ( x === '%%' ) return '%' ;
You can’t perform that action at this time.
0 commit comments