0
0

🎉 typ command

This commit is contained in:
DrMaxNix 2022-10-01 20:12:43 +02:00
parent 5ed0341061
commit f107c4548a

31
src/command/typ.js Normal file
View File

@ -0,0 +1,31 @@
Juicescript.command_define({
name: "typ",
alias: ["type"],
validate: function(runner){
// count
runner.argument_validate_count(1);
if(runner.has_error) return;
// types
runner.argument_validate_type(1, Juicescript.argument_type.VARIABLE);
},
execute: function(runner){
// GET VARIABLE //
// resolve argument to absolute variable object
let variable = runner.argument_variable(1);
// GET TYPE STRING //
// get variable's type
let type = runner.variable_type(variable);
// convert to string
let type_string = Juicescript.variable_type.name(type).toLowerCase();
// STORE BACK INTO VARIABLE //
runner.variable_set(variable, type_string);
}
});