M.metadata(), with some useful additions:
_(M.Map, [date(), number()])
asIs(x => 2 * x)to double numbers. It serves as base for primitive metadata and can be used to fix a value for debugging purposes, eg.:
asIs(() => 0). It is up to you to implement
toJSON()on the instance to reverse the transformation if you need to.
typeif not provided. See Reviving polymorphic JSON: (example 1) for an example. Note that
anyOfdoes not return metadata, but a metadata-returning function. This is something you can use as well to revive some cases of polymorphic JSON.