lucapasquale / insomnia-plugin-chance

Insomnia Plugin for Chance.JS
MIT License
15 stars 4 forks source link

Using custom pickone function #4

Closed Froelund closed 5 years ago

Froelund commented 5 years ago

Currently I am unable to use the chancejs pickone. The interface fails to validate the options as valid JSON.

image

I believe it's related to the plugin wrapping the opts in {} when parsing. https://github.com/lucapasquale/insomnia-plugin-chance/blob/master/index.js#L44

lucapasquale commented 5 years ago

Great catch! I've tried your PR but it seemed that it if I removed the { ... } it would break when the arguments were not an array.

I've created a new branch that fixes that, and checks if the options are an array or just an object. I also added the pickone function, since it's really useful!

Thanks for the help

Froelund commented 5 years ago

Great! Thanks 👍