Skip to content

Commit

Permalink
Merge pull request #24 from scoville/cleanup-doc
Browse files Browse the repository at this point in the history
As of today the doc uses @ocaml.doc`
  • Loading branch information
gaku-sei authored Jan 14, 2021
2 parents 776683f + a33aaa1 commit 7f5e2bb
Showing 1 changed file with 8 additions and 10 deletions.
18 changes: 8 additions & 10 deletions src/FormidableValidations.res
Original file line number Diff line number Diff line change
@@ -1,19 +1,18 @@
/* * Strategy used during validation, on change, on blur, or on demand.
* On demand validation will not be triggered automatically, and you need
* to use the validate function manually.
*/
@ocaml.doc(`Strategy used during validation, on change, on blur, or on demand.
On demand validation will not be triggered automatically, and you need
to use the validate function manually.`)
module Strategy = {
type t = [#onBlur | #onChange | #onDemand]
}

/* * The value returned by a validator, ok or error */
@ocaml.doc(`The value returned by a validator, ok or error`)
module Value = {
type t<'value, 'error> = [#ok('value) | #error('error)]
}

/* * The validator is the function that performs the validation */
@ocaml.doc(`The validator is the function that performs the validation`)
module Validator = {
/* * The arguments provided to the validator function */
@ocaml.doc(`The arguments provided to the validator function`)
module Args = {
type t<'values, 'value, 'error> = {
label: option<string>,
Expand Down Expand Up @@ -58,9 +57,8 @@ let getNames = ((_, {Description.names: names})) => names

let getValidator = ((_, {Description.validator: validator})) => validator

/* * Returns true if a validation should be performed in the given context.
If no context is provided, always returns true */

@ocaml.doc(`Returns true if a validation should be performed in the given context.
If no context is provided, always returns true`)
let shouldValidate = (~context, ~strategy) =>
switch (context, strategy) {
| (None, _)
Expand Down

0 comments on commit 7f5e2bb

Please sign in to comment.