import { type Packer } from "https://deno.land/x/cav@0.0.14/pack.ts";
A group of functions used to recognize, pack, and unpack objects and special values that are not strings, basic numbers, booleans, or nulls into objects that are JSON compatible.
Methods
Function for checking if the packer applies to a given value. JSON
primitives like basic numbers, strings, booleans, and nulls skip all
packers and are returned as-is. i.e. check: (v) => typeof v === "string"
would always return false.
Transforms the value into its output on the resulting json-compatible object. The value returned by this function will be re-packed; the output does not need to be JSON-compatible.
Unpacks packed values into their original shape and structure. Initially,
the value is only constructed from the raw packed JSON. Values that are
more complex and need things like referential equality or non-POJO/Array
objects will need to use the whenDone
registration function to access the
equivalent of the value returned from pack()
when the value was
serialized. (See the docs for the WhenDone type for more details.)