Function looksLikeBoolean

  • Checks whether a given value looks like a boolean, where something that looks like a boolean is either an actual boolean, or a string containing the case insensitive text "true" or "false". Either way, a boolean can be derived from the value.

    If string values other than "true" or "false" are considered valid boolean indicators, then the acceptedBooleanTokens parameter can be used to pass in a list of ALL string values that are considered valid boolean indicators, for eg: ["true", "false", "1", "0"]

    Returns

    Returns a boolean indicating whether the value looks like a boolean

    Parameters

    • value: any
    • acceptedBooleanTokens: string[] = ...

      A optional list of case insensitive string tokens considered to be valid boolean indicators, the default is ["true", "false"]

    Returns boolean

Generated using TypeDoc