Skip to content

Required

module Required
AssemblyFable.UrlParser

Functions and values

custom<'A, 'Output> (key: string) (typeName: string) (tryParse: string -> 'A option) (innerParser: UrlParser<('A -> 'Output)>) : UrlParser<'Output>

Parse a single query parameter, using a custom conversion function.

This function will fail if:

  • The key is absent.
  • tryParse returns None for the value.
  • The key is present more than once in the query.
Parameter
keyKey to look up
typeNameName reported in the error message when conversion fails, e.g. "Guid"
tryParseFunction attempting to convert the value string into 'A
innerParserParser to apply

Returns. The converted value if the key is present exactly once and converts successfully

int<'Output> (key: string) (innerParser: UrlParser<(int -> 'Output)>) : UrlParser<'Output>

Parse a single query parameter as an int.

This function will fail if:

  • The key is absent.
  • The key is present but cannot be parsed as a valid integer.
  • The key is present more than once in the query.
Parameter
keyKey to look up
innerParserParser to apply

Returns. The integer value if the key is present exactly once and is a valid int

string<'Output> (key: string) (innerParser: UrlParser<(string -> 'Output)>) : UrlParser<'Output>

Parse a single query parameter as a string.

This function will fail if:

  • The key is absent.
  • The key is present more than once in the query.
Parameter
keyKey to look up
innerParserParser to apply

Returns. The string value if the key is present exactly once