Is there a best practice for how to pass options to functions that take multiple options in ReasonML?
Two approaches:
-
bs-clean-deep, takes all options as optional arguments and data in last:CleanDeep.cleanDeep( ~emptyStrings=false, ~emptyArrays=false, someJsObject ) -
bs-marky-markdown, takes a record with options:MarkyMarkdown.marky( "# My Markdown String", ~options=MarkyMarkdown.options( ~highlightSyntax=false, () ), () )
Is any of these preferred, does it depend, or is it other preferred ways of doing this in ReasonML?
in a function with optional parameters, the compiler needs a final, non-optional parameter to be able to decide when the function is syntactically ‘fully applied’. See