Converts a Maybe value to a JavaScript object that may be stored as a JSON value.
This API is still experimental, so it may change or be removed in future versions. You should not rely on it for production applications.
type JSONSerialisation = {
  "@@type":  String,
  "@@tag":   String,
  "@@value": Object Any
}
Variant . () => JSONSerialisationConverts a Maybe value to a JavaScript object that may be stored as a JSON value.
See the docs for adt/union/derivations/serialization for more details.
const Maybe = require('folktale/maybe');
Maybe.Just(1).toJSON();
// ==> { '@@type': 'folktale:Maybe', '@@tag': 'Just', '@@value': { value: 1 } }
Maybe.Nothing().toJSON();
// ==> { '@@type': 'folktale:Maybe', '@@tag': 'Nothing', '@@value': {} }
function() {
    return { 
      [typeJsonKey]:  typeName, 
      [tagJsonKey]:   tagName, 
      [valueJsonKey]: mapValues(this, serializeValue) 
    };
  }