A Laravel(ish) Optional helper in Javascript

My attempt at creating an optional helper.

Laravels optional helper can be pretty useful. With its new optional closure you can do even more.

I wanted something similar in javascript so I wrote this based on my Laravel(ish) resource/transformer.

You can also provide a callback that will be called if the option exists.