Wrap option value with strong quotes and escape it

- Strong quoting of option value.
- Escape single quotes in option value.
- Abstract and DRY option construction.

I think that should do the job.
Feel free to ping me about any updates to the PR.
This looks wrong. Should it be `value.replace(/'/g, "\\\'");`?