how to get vorpal argument as an array
zelaxo opened this issue · comments
Arjun Nair commented
Vorpal arguments are returned as a string. How to get them as it is, ie. get an object array as an object array.
Please refer here for a broader explanation : https://stackoverflow.com/q/53297013/8619824
Filippo Conti commented
@zaygozi it should be command <arg...>
according to the documentation, are called variadic arguments
Arjun Nair commented
@b4dnewz But variadic arguments return an array of strings. So if the input is {name:'anon',time:9}
, this is returned as a type string & not an object. The only way I found to resolve this was to pass the input as a json object {"name":"arjun","time":9}
& then use JSON.parse
to retrieve the object from the string.