@uirouter/core/common/strings | @uirouter/angular
Options
All
  • Public
  • Public/Protected
  • All
Menu

Module @uirouter/core/common/strings

Functions that manipulate strings

Although these functions are exported, they are subject to change without notice.

Index

Variables

Const hostRegex

hostRegex: RegExp = new RegExp('^(?:[a-z]+:)?//[^/]+/')

Const splitEqual

splitEqual: (Anonymous function) = beforeAfterSubstr('=')

Const splitHash

splitHash: (Anonymous function) = beforeAfterSubstr('#')

Const splitQuery

splitQuery: (Anonymous function) = beforeAfterSubstr('?')

Functions

Const beforeAfterSubstr

  • beforeAfterSubstr(char: string): (Anonymous function)

fnToString

functionToString

  • functionToString(fn: Function): any

joinNeighborsR

  • joinNeighborsR(acc: any[], x: any): any[]
  • Reduce fn that joins neighboring strings

    Given an array of strings, returns a new array where all neighboring strings have been joined.

    Example:

    let arr = ["foo", "bar", 1, "baz", "", "qux" ];
    arr.reduce(joinNeighborsR, []) // ["foobar", 1, "bazqux" ]

    Parameters

    • acc: any[]
    • x: any

    Returns any[]

kebobString

  • kebobString(camelCase: string): string

maxLength

  • maxLength(max: number, str: string): string
  • Returns a string shortened to a maximum length

    If the string is already less than the max length, return the string. Else return the string, shortened to max - 3 and append three dots ("...").

    Parameters

    • max: number

      the maximum length of the string to return

    • str: string

      the input string

    Returns string

padString

  • padString(length: number, str: string): string
  • Returns a string, with spaces added to the end, up to a desired str length

    If the string is already longer than the desired length, return the string. Else returns the string, with extra spaces on the end, such that it reaches length characters.

    Parameters

    • length: number

      the desired length of the string to return

    • str: string

      the input string

    Returns string

splitOnDelim

  • splitOnDelim(delim: string): (Anonymous function)
  • Splits on a delimiter, but returns the delimiters in the array

    Example:

    var splitOnSlashes = splitOnDelim('/');
    splitOnSlashes("/foo"); // ["/", "foo"]
    splitOnSlashes("/foo/"); // ["/", "foo", "/"]

    Parameters

    • delim: string

    Returns (Anonymous function)

stringify

  • stringify(o: any): string

Const stripLastPathElement

  • stripLastPathElement(str: string): string

Const trimHashVal

  • trimHashVal(str: string): string

Generated using TypeDoc