vorpal icon indicating copy to clipboard operation
vorpal copied to clipboard

how to get vorpal argument as an array

Open zelaxo opened this issue 5 years ago • 2 comments

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

zelaxo avatar Nov 14 '18 05:11 zelaxo

@zaygozi it should be command <arg...> according to the documentation, are called variadic arguments

b4dnewz avatar Dec 09 '18 14:12 b4dnewz

@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.

zelaxo avatar Dec 14 '18 08:12 zelaxo