-
lowercasedonkey authoredlowercasedonkey authored
Standalone JS Functions
Collection of custom functions without dependencies on FC specific variables/data structures.
utilJS.js
-
arraySwap(array, a , b)
:
Swaps two values in an array. -
capFirstChar(string)
:
Capitalizes the first character ofstring
. -
addA(word)
: Adds anan
if the first character is a vocal, otherwisea
. -
ordinalSuffix(i)
:
Takes a number and appends the appropriate suffix. Example:ordinalSuffix(1)
gives1st
. -
ordinalSuffixWords(i)
:
Takes a number and returns the appropriate ordinal. Example:ordinalSuffix(1)
givesfirst
.
For number greater than 19 identical toordinalSuffix(i)
-
removeDuplicates(array)
:
Takes an array and returns a new array without duplicate entries. -
jsDef(x)
:
Returns whether x is undefined. A JS port of SugarCube's def. -
between(a, low, high)
:
Returnstrue
ifa
is betweenlow
andhigh
, otherwisefalse
.