new Registry()
Singleton factory that accepts a value to be printed, queries it's type, and returns an appropriate formatter for that type.
- Source:
Methods
addType(typeTest, formatter)
Register a new type with the factory.
Parameters:
Name | Type | Description |
---|---|---|
typeTest |
function | A function which returns true when the type is recognized. |
formatter |
function | A formatting function for this type. |
- Source:
getFormatter(failureStrategy, value) → {Subject}
Create a new Subject instance given a value. The factory will look through the list of registered types to find a subject constructor function, and return the appropriate Subject subclass for that value type.
Parameters:
Name | Type | Description |
---|---|---|
failureStrategy |
FailureStrategy | The failure strategy to use when an assertion fails. |
value |
* | The value being checked. |
- Source:
Returns:
A subject instance.
- Type
- Subject