Skip to content

array

DDataParser.array() validates homogeneous arrays by applying an element parser and checkers (min, max, refine, ...). Each error includes the faulty index (items[2]).

Interactive example

Parameters

  • element: parser used for each entry (can be an object, union, etc.).
  • checkers: checkerArrayMin, checkerArrayMax, checkerRefine, etc.
  • errorMessage: custom message when the input is not an array.

Return value

A DataParserArray with parse, asyncParse, exec, asyncExec, addChecker, clone. parse returns DEither.success<Element[]> or DEither.error<DataParserError> with the faulty indexes.

Other examples

Custom checkers

Extended mode

See also

Released under the MIT license.