Skip to content

Commit e5f5740

Browse files
save file
1 parent 00b965c commit e5f5740

File tree

1 file changed

+32
-26
lines changed

1 file changed

+32
-26
lines changed

utils/editors/js-console/html/output-console/output-console.html

Lines changed: 32 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -684,32 +684,37 @@
684684

685685
function format(args){
686686

687-
if (typeof args[0] !== "string") return args;
688-
689-
let fmt = args[0];
690-
let out = [];
691-
let argIndex = 1;
692-
693-
out.push(fmt.replace(/%[sdifoO]/g, (match) => {
694-
695-
const val = args[argIndex++];
696-
switch (match) {
697-
case "%s": return ''+val;
698-
case "%d":
699-
case "%i": return parseInt(val, 10);
700-
case "%f": return parseFloat(val);
701-
case "%o":
702-
case "%O": return format.fn(val);
703-
default:
704-
return match;
705-
}
706-
687+
if(typeof args[0]!=='string')return args;
688+
689+
let fmt = args[0];
690+
let out = [];
691+
let argIndex = 1;
692+
693+
out.push(fmt.replace(/%[sdifoO]/g,match=>{
694+
695+
var val = args[argIndex++];
696+
697+
switch (match) {
698+
699+
case '%s' : return ''+val;
700+
case '%d' :
701+
case '%i' : return parseInt(val, 10);
702+
case '%f' : return parseFloat(val);
703+
case '%o' :
704+
case '%O' : return format.fn(val);
705+
default : return match;
706+
707+
}//switch
708+
707709
}));
708710

709-
// Append any remaining args
710-
while (argIndex < args.length) {
711-
out.push(args[argIndex++]);
712-
}
711+
712+
while(argIndex<args.length){
713+
714+
var v = args[argIndex++];
715+
out.push(v);
716+
717+
}//while
713718

714719
return out;
715720

@@ -726,7 +731,7 @@
726731

727732
}//switch
728733

729-
return JSON.stringify(val,null,2);
734+
return JSON.stringify(val,null,4);
730735
}//fn
731736

732737
}//format
@@ -755,8 +760,9 @@
755760

756761
}//switch
757762

758-
var type = datatype(val);
759763

764+
var type = datatype(val);
765+
console.log('format.fn',type);
760766
if(type=='array'){
761767
return '['+val.map(v=>fn(v,seen)).join(', ')+']';
762768
}

0 commit comments

Comments
 (0)