Options
All
  • Public
  • Public/Protected
  • All
Menu

Class TagsProcessor

Helper class to extract and process search tags from objects. The search tags can be kept individually or embedded as hash tags inside text like "This text has #hash_tag that can be used for search."

Hierarchy

  • TagsProcessor

Index

Methods

Static compressTag

  • compressTag(tag: string): string
  • Compress a tag by removing special symbols like spaces, '_' and '#' and converting the tag to lower case. When tags are compressed they can be matched in search queries.

    Parameters

    • tag: string

      the tag to compress.

    Returns string

    a compressed tag.

Static compressTagList

  • compressTagList(tagList: string): string[]
  • Compresses a comma-separated list of tags.

    Parameters

    • tagList: string

      a comma-separated list of tags to compress.

    Returns string[]

    a list with compressed tags.

Static compressTags

  • compressTags(tags: string[]): string[]
  • Compresses a list of tags.

    Parameters

    • tags: string[]

      the tags to compress.

    Returns string[]

    a list with normalized tags.

Static equalTags

  • equalTags(tag1: string, tag2: string): boolean
  • Compares two tags using their compressed form.

    Parameters

    • tag1: string

      the first tag.

    • tag2: string

      the second tag.

    Returns boolean

    true if the tags are equal and false otherwise.

Static extractHashTags

  • extractHashTags(text: string): string[]
  • Extracts hash tags from a text.

    Parameters

    • text: string

      a text that contains hash tags

    Returns string[]

    a list with extracted and compressed tags.

Static extractHashTagsFromValue

  • extractHashTagsFromValue(obj: any, ...searchFields: string[]): string[]
  • Extracts hash tags from selected fields in an object.

    Parameters

    • obj: any

      an object which contains hash tags.

    • Rest ...searchFields: string[]

      a list of fields in the objects where to extract tags

    Returns string[]

    a list of extracted and compressed tags.

Static normalizeTag

  • normalizeTag(tag: string): string
  • Normalizes a tag by replacing special symbols like '_' and '#' with spaces. When tags are normalized then can be presented to user in similar shape and form.

    Parameters

    • tag: string

      the tag to normalize.

    Returns string

    a normalized tag.

Static normalizeTagList

  • normalizeTagList(tagList: string): string[]
  • Normalizes a comma-separated list of tags.

    Parameters

    • tagList: string

      a comma-separated list of tags to normalize.

    Returns string[]

    a list with normalized tags.

Static normalizeTags

  • normalizeTags(tags: string[]): string[]
  • Normalizes a list of tags.

    Parameters

    • tags: string[]

      the tags to normalize.

    Returns string[]

    a list with normalized tags.

Generated using TypeDoc