convnum
    Preparing search index...

    Function getTypes

    • Identifies all possible types of input string among all supported types in this library. Returns TypeInfo objects that include the detected type along with contextual properties like case (lower, upper, sentence, title) and format (short, long) when applicable.

      Parameters

      • str: string

        The input string to identify and analyze

      Returns TypeInfo[]

      An array of all possible TypeInfo objects the string could be, including detected case and format properties, sorted by type priority (see VALID_NUM_TYPES)

      getTypes('123') // returns [{ type: 'decimal' }, { type: 'octal' }, { type: 'hexadecimal', case: 'lower' }]
      getTypes('A') // returns [{ type: 'latin_letter', case: 'upper' }, { type: 'hexadecimal', case: 'upper' }]
      getTypes('IV') // returns [{ type: 'roman', case: 'upper' }]
      getTypes('January') // returns [{ type: 'month_name', case: 'sentence', format: 'long' }]
      getTypes('Jan') // returns [{ type: 'month_name', case: 'sentence', format: 'short' }]
      getTypes('Twenty-One') // returns [{ type: 'english_words', case: 'title' }]
      getTypes('δΈ€') // returns [{ type: 'chinese_words' }]
      getTypes('invalid-string') // returns [{ type: 'unknown' }]
      getTypes('') // returns [{ type: 'empty' }]
      getTypes(null) // returns [{ type: 'invalid' }]