shuffle

Shuffle array in place. Source: https://stackoverflow.com/a/6274381/616095

shuffle(a: array): array
Parameters
a (array)
Returns
array: Shuffled

unique

Filter array by unique values. Source: https://stackoverflow.com/a/14438954/616095

unique(a: array): array
Parameters
a (array)
Returns
array: Without duplicates

documentWidth

Get the viewport width.

documentWidth(): number
Returns
number: Viewport width

querySelectorAllAsArray

Consistent cross-browser querySelectorAll (on Edge you can’t use .forEach on a NodeList).

querySelectorAllAsArray($container: Element, selector: string): array
Parameters
$container (Element) any element
selector (string) used by querySelectorAll
Returns
array: Of elements

kebabCaseToPascalCase

kebab-case to PascalCase.

kebabCaseToPascalCase(string: string): string
Parameters
string (string)
Returns
string: PascalCase

numberFromString

Return the number included in a string.

numberFromString(string: string): number
Parameters
string (string)
Returns
number: Given string as a number

pascalCaseToKebabCase

PascalCase to kebab-case.

pascalCaseToKebabCase(string: string): string
Parameters
string (string)
Returns
string: kebab-case