Visitor : Design Patterns in TypeScript
https://www.amazon.com/dp/B0948BCH24 : ASIN B0948BCH24
https://www.amazon.com/dp/B094716FD6 : ASIN B094716FD6
Documentation : https://sbcode.net/typescript/visitor/
our object structure inside an application may be complicated and varied. A good example is what could be created using the Composite structure.
The objects that make up the hierarchy of objects, can be anything and most likely complicated to modify as your application grows.
Instead, when designing the objects in your application that may be structured in a hierarchical fashion, you can allow them to implement a Visitor interface.
The Visitor interface describes an accept() method that a different object, called a Visitor, will use in order to traverse through the existing object hierarchy and read the internal attributes of an object.
The Visitor pattern is useful when you want to analyze, or reproduce an alternative object hierarchy without implementing extra code in the object classes, except for the original requirements set by implementing the Visitor interface.
#visitorPattern
#typescriptVisitor
#visitorPatternTypescript