0
0

own stringify helper

This commit is contained in:
DrMaxNix 2022-10-02 13:32:27 +02:00
parent 42c33d8951
commit 196f6e755c
2 changed files with 15 additions and 1 deletions

View File

@ -18,7 +18,7 @@ Juicescript.command_define({
let string = "";
for(var q = 1; q <= runner.command.argument.length; q++){
// append to string
string += runner.argument_value(q).toString();
string += runner.stringify(runner.argument_value(q));
}

View File

@ -408,6 +408,20 @@ class Juicescript_runner {
return (this.error_count > 0);
}
/*
HELPER: Express VALUE as a string
*/
stringify(value){
// NULL //
if(value === null){
return "null";
}
// TRY JAVASCRIPT'S `toString()` //
return value.toString();
}
/*
HELPER: Automagically keep track of problems and add additional info to stderr
*/