Variable stringHelperConst

stringHelper: {
    firstOrEmpty: ((values) => string);
    formatToUi: ((...args) => string);
    isNullOrEmpty: ((value?) => boolean);
    joinOrEmpty: ((values, separator?) => string);
    orEmpty: ((value?) => string);
    trimToLength: ((inputString, stringLength) => string);
} = ...

Type declaration

  • firstOrEmpty: ((values) => string)
      • (values): string
      • Returns the first element which is not empty. Returns empty if all are empty.

        Parameters

        • values: readonly (undefined | string)[]

          The list of values

        Returns string

        Returns the first element which is not empty. Returns empty if all are empty.

  • formatToUi: ((...args) => string)
      • (...args): string
      • Used for formatting string to echo standard, with - as separator. Returns - if the joined string is empty. Will handle undefined as input argument.

        Parameters

        • Rest ...args: (undefined | string)[]

        Returns string

        {string}

        Export

  • isNullOrEmpty: ((value?) => boolean)
      • (value?): boolean
      • Returns true if the specified string is undefined, empty, contains only white-spaces, or contains double quotes ("").

        Parameters

        • Optional value: string

          The specific value to check.

        Returns boolean

        Returns true if the string is undefined, empty, contains only white-spaces, or contains double quotes ("").

  • joinOrEmpty: ((values, separator?) => string)
      • (values, separator?): string
      • Joins all nonEmpty elements into one string with the optional separator (defaults to 1 space).

        Parameters

        • values: readonly (undefined | string)[]

          The elements to join

        • Optional separator: string

          Optional separator (defaults to 1 space).

        Returns string

        All none empty values as one string. Returns empty if all elements are empty.

  • orEmpty: ((value?) => string)
      • (value?): string
      • Returns an empty string if the string isNullOrEmpty, otherwise returns original string.

        Parameters

        • Optional value: string

          The string to check.

        Returns string

        Returns an empty string if the string isNullOrEmpty, otherwise returns original string.

  • trimToLength: ((inputString, stringLength) => string)
      • (inputString, stringLength): string
      • Trims a string based on a given length. If the string is longer than the given length, it adds '...' at the end.

        Parameters

        • inputString: string
        • stringLength: number

        Returns string

        Returns the trimmed string with '...' at the end, if the string is longer than the given length. If not, returns the original string.

Generated using TypeDoc