Options
All
  • Public
  • Public/Protected
  • All
Menu

Module text

Text Basic Functions

textBasicMask

  • textBasicMask(text: string, mask?: string, showFirst?: number, showLast?: number): string
  • name

    textBasicMask

    description

    Function for masking the character.

    summary

    import { textBasicMask } from "@corefunc/corefunc/text/basic/mask";

    since

    0.3.55

    Parameters

    • text: string
    • mask: string = "*"
    • showFirst: number = 1
    • Optional showLast: number

    Returns string

textBasicPlain

  • textBasicPlain(text: string): string
  • name

    textBasicPlain

    description

    Remove all ANSI colors/styles from string.

    summary

    import { textBasicPlain } from "@corefunc/corefunc/text/basic/plain";

    since

    0.3.58

    Parameters

    • text: string

    Returns string

    Text.

textBasicSlugify

  • textBasicSlugify(text: string): string
  • name

    textBasicSlugify

    description

    Minimalistic text slugify.

    summary

    import { textBasicSlugify } from "@corefunc/corefunc/text/basic/slugify";

    since

    0.3.27

    example

    textBasicSlugify("This is blog post link!"); ➜ "this-is-blog-post-link"

    Parameters

    • text: string

    Returns string

    Slug text.

textFromNumber

  • textFromNumber(numberToWords: number): string

Text Case Functions

textCaseAbbreviate

  • textCaseAbbreviate(text: string, abbrLettersCount?: number): string
  • name

    textCaseAbbreviate

    description

    Builds abbreviated string from given string.

    Parameters

    • text: string
    • abbrLettersCount: number = 1

    Returns string

textCaseCamel

  • textCaseCamel(text: string, firstCapital?: boolean): string

textCaseCapitalize

  • textCaseCapitalize(text: string): string
  • name

    textCaseCapitalize

    description

    Capitalize first letter

    summary

    import { textCaseCapitalize } from "@corefunc/corefunc/text/case/capitalize";

    since

    0.1.31

    Parameters

    • text: string

    Returns string

    Capitalized first letter

textCaseKebab

  • textCaseKebab(text: string): string

textCaseLower

  • textCaseLower(text: string): string
  • name

    textCaseLower

    description

    Converts string into lower-case. Converts and normalizes the string before conversion.

    since

    0.1.31

    Parameters

    • text: string

      Text to transform

    Returns string

    Lower-case text

textCaseScreamingSnake

  • textCaseScreamingSnake(text: string): string
  • name

    textCaseScreamingSnake

    description

    Converts string into screaming snake-case.

    since

    0.3.33

    Parameters

    • text: string

      Text to transform

    Returns string

textCaseSnake

  • textCaseSnake(text: string): string
  • name

    textCaseSnake

    description

    Converts string into snake-case.

    summary

    import { regexMatch } from '@corefunc/corefunc/text/case/snake';

    see

    https://regex101.com/r/QeSm2I/1

    since

    0.3.33

    Parameters

    • text: string

    Returns string

textCaseTitle

  • textCaseTitle(text: string): string

textCaseTrain

  • textCaseTrain(text: string): string
  • name

    textCaseTrain

    description

    Converts string into train-case.

    since

    0.1.31

    Parameters

    • text: string

      Text to transform

    Returns string

    Train-case text

textCaseUpper

  • textCaseUpper(text: string): string
  • name

    textCaseUpper

    description

    Converts string into upper-case. Converts and normalizes the string before conversion.

    since

    0.1.31

    Parameters

    • text: string

      Text to transform

    Returns string

    Uppercase text

Text Emoji Functions

textEmojiJoin

  • textEmojiJoin(emoji: string, ...emojis: string[]): string
  • name

    textEmojiJoin

    description

    Join emoji.

    summary

    import { textEmojiJoin } from "@corefunc/corefunc/text/emoji/join";

    since

    0.3.27

    example

    "πŸ‘¨" + "πŸ’»" ➜ "πŸ‘¨πŸ’»"

    example

    textEmojiJoin("πŸ‘¨", "πŸ’»") ➜ "πŸ‘¨β€πŸ’»"

    Parameters

    • emoji: string

      Emoji.

    • Rest ...emojis: string[]

      Emojis to join.

    Returns string

    Joined emoji.

Text Fit Functions

textFitLength

  • textFitLength(text: string, length?: number, addEllipsis?: boolean): string
  • name

    textFitLength

    description

    Trim and fit text to length

    summary

    import { textFitLength } from '@corefunc/corefunc/text/fit/length';

    example

    textFitLength("Hello, world!", 6) ➜ "Hello…"

    since

    0.1.69

    Parameters

    • text: string
    • length: number = 99
    • addEllipsis: boolean = true

    Returns string

    New text.

Generated using TypeDoc