You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
These are unit tests, but the transform function that each exports is only ever called by the Transformer class, which applies any default options defined within a transformer. Calling these functions directly does not apply those defaults.
The reasoning behind defining defaults in the meta object is threefold:
We can merge any custom options deeply within them, which would otherwise be boilerplate in each transform function
Defaults can (in the future) and should be applied via schema validation (ajv). If the merging of options happened within the transform function itself, this would not be possible.
When two transformers are chained together, the next transformer pulls in defaults from the previous one. This allows a chain of something like diff -> table to have its output defined by the diff transformer--the table transformer does not and cannot know how to display this data.
The text was updated successfully, but these errors were encountered:
These are unit tests, but the
transform
function that each exports is only ever called by theTransformer
class, which applies any default options defined within a transformer. Calling these functions directly does not apply those defaults.The reasoning behind defining defaults in the
meta
object is threefold:transform
functionajv
). If the merging of options happened within thetransform
function itself, this would not be possible.diff
->table
to have its output defined by thediff
transformer--thetable
transformer does not and cannot know how to display this data.The text was updated successfully, but these errors were encountered: