diff --git a/README.md b/README.md index 1063f69..63722d1 100644 --- a/README.md +++ b/README.md @@ -20,7 +20,7 @@ this library makes no assumptions about formats and loosely follows the architec with the exception of iterables and classes, these types were chosen as they are the ones provided by Javascript's native `typeof` operator which is used internally for type checking. -there are four interfaces which are relevant to `serde-ts` users. +there are five interfaces which are relevant to `serde-ts` users. ## `Serializer` @@ -76,6 +76,21 @@ interface Deserialize { `Deserialize` is responsible for transforming a value *from* the internal data model. it is the inverse of `Serialize`. depending on the `Deserialize` target, it may accept an iterable of numbers and produce a `Vector2`. +## `Visitor` +```ts +interface IVisitor { + visitBoolean(value: boolean): T + visitNumber(value: number): T + visitBigInt(value: bigint): T + visitString(value: string): T + visitSymbol(value: symbol): T + visitNull(): T + visitObject(access: IMapAccess): T + visitIterable(access: IIterableAccess): T +} +``` + +a `Visitor` is part of the deserialization process and is how each data type is mapped from the internal data model to whatever the end structure is. `Deserialize` is responsible for creating a `Visitor` and giving it to a `Deserializer`. that `Visitor` will then be given every value once it has been deserialized into `serde-ts`'s internal model. # Example