pyralite (master) doxdox documentation

JavaScript addon with more memorable function names, extra utilities, and shorthand

# Array.first()

Return the first element of an array.

# Array.last()

Return the last element of an array.

# Array.shuffle()

Shuffle an array.

# HTMLElement.defocus()

Defocus an HTML element. Alias for blur().

# HTMLElement.innerHtml(text)

Set the inner HTML of an element.

Parameters

Name Types Description
text String - The string to set the inner HTML to.

# HTMLElement.outerHtml(text)

Set the outer HTML of an element.

Parameters

Name Types Description
text String - The string to set the outer HTML to.

# HTMLElement.setFocus(boolean)

Set the focus of an HTML element on or off. Good for toggling.

Parameters

Name Types Description
boolean Boolean - Whether to focus or defocus the element.

# HTMLElement.setStyle(sty, value)

Sets a style rule of an element.

Parameters

Name Types Description
sty String - The style to set.
value (String Number)

# HTMLElement.text(text)

Set the inner text of an HTML element.

Parameters

Name Types Description
text String - The string to set the inner text to.

# Math.gcd(a, b)

Get the GCD (Greatest Common Denominator) of 2 numbers.

Parameters

Name Types Description
a Number
b Number

# Math.reduce(numerator, denominator)

Reduce a fraction (written as a/b). Makes use of {@link Math#gcd}.

Parameters

Name Types Description
numerator Number
denominator Number

# Number.isEven()

Check if a number is even.

# Number.round(places)

Round a number to some places. Not to be confused with Math.round.

Parameters

Name Types Description
places Number - How many decimal places to round the number to. Default 2.

# pyralite.elemById(id)

Alternative to document.getElementById.

Parameters

Name Types Description
id String - ID to get element from.

# pyralite.elemsByClass(class)

Gets elements by the provided class (e.g. "big", "testclasss")

Parameters

Name Types Description
class String - The class to use.

# pyralite.elemsByTag(tag)

Gets elements by the provided tag (e.g. "h1", "em")

Parameters

Name Types Description
tag String - The tag to use.