API Docs for:
Show:

Formatter.util Class

Defined in: ../lib/pat.js:446
Module: pat

Utility functions.

Item Index

Methods

Methods

concat

(
  • arg
  • [n
)
String static

Defined in ../lib/pat.js:486

Concatenates the given argument n-1 times with itself and returns the resulting string.

Parameters:

  • arg String
  • [n Number

    = 1]

Returns:

String:

isArray

(
  • arg
)
Boolean static

Defined in ../lib/pat.js:452

Returns true if the given arg is an Array, false otherwise.

Parameters:

  • arg Any

Returns:

Boolean:

isString

(
  • arg
)
Boolean static

Defined in ../lib/pat.js:462

Returns true if the given arg is a String, false otherwise.

Parameters:

  • arg Any

Returns:

Boolean:

pad

(
  • str
  • [ch
  • [len
  • [left
)
String static

Defined in ../lib/pat.js:499

Appends or prepends the given character to the given string until the resulting string has the specified length.

Parameters:

  • str String

    Append or prepend to this string

  • [ch String

    = ' '] Character to be appended or prepended

  • [len Number

    = String(str).length] Length of the resulting string

  • [left Boolean

    = false] Prepend if true, append otherwise

Returns:

String:

padLeft

(
  • str
  • [ch
  • [len
)
String static

Defined in ../lib/pat.js:521

Prepends the given character to the given string until the resulting string has the specified length.

Parameters:

  • str String

    Prepend to this string

  • [ch String

    = ' '] Character to be prepended

  • [len Number

    = String(str).length] Length of the resulting string

Returns:

String:

padRight

(
  • str
  • [ch
  • [len
)
String static

Defined in ../lib/pat.js:534

Appends the given character to the given string until the resulting string has the specified length.

Parameters:

  • str String

    Append to this string

  • [ch String

    = ' '] Character to be appended

  • [len Number

    = String(str).length] Length of the resulting string

Returns:

String:

toArray

(
  • arg
)
Array static

Defined in ../lib/pat.js:472

Returns the argument, a character array or an array of length 1 containing the argument depending whether the argument is an array, a string or any other value.

Parameters:

  • arg Any

Returns:

Array: