append(arr1, arr2):Array
Appends an array to the end of the other. The first array will be modified and will contain the appended items.
combine(arr1, arr2):Array
Combines an array with all the items of another. The first array will be modified and will contain the combined items.
Does not allow duplicates and is case and type sensitive.
compact(arr):Array
Returns a new Array without any null or undefined values. Note that it will keep empty strings and other falsy values (simillar to Ruby Array#compact).
contains(arr, value):Boolean
Checks if Array contains value. Alias to indexOf(arr, val) !== -1.
difference(...arrs):Array
Return a new Array with elements that aren't present in the other Arrays besides the first one.
every(arr, callback, [thisObj]):Array
Crossbrowser Array.every().
filter(arr, callback, [thisObj]):Array
Crossbrowser Array.filter().
find(arr, callback, [thisObj]):void
Loops through all the items in the Array and returns the first one that passes a truth test (callback).
flatten(arr, [shallow]):Array
Recursively flattens an array. A new array containing all the elements is returned. If shallow is true, it will only flatten one level.
forEach(arr, callback, [thisObj]):void
Crossbrowser Array.forEach().
indexOf(arr, item, [fromIndex]):Number
Crossbrowser Array.indexOf().
insert(arr, ...items):Number
Push items into array only if they aren't contained by it. Returns the new length of the array.
intersection(...arrs):Array
Return a new Array with elements common to all Arrays.
invoke(arr, methodName[, ...args]):Array
Call methodName on each item of the array passing custom arguments if needed.
join(arr, [separator]):String
Joins the strings in arr, inserting separator between each value.
lastIndexOf(arr, item, [fromIndex]):Number
Crossbrowser Array.lastIndexOf().
map(arr, callback):Array
Crossbrowser Array.map().
max(arr[, iterator]):*
Returns maximum value inside array or use a custom iterator to define how items should be compared.
min(arr[, iterator]):*
Returns minimum value inside array or use a custom iterator to define how items should be compared.
pick(arr):*
Gets a random item and remove it from the array.
pluck(arr, propName):Array
Extract a list of property values.
range([start], stop[, step]):Array
Creates a new Array with all the values inside the range. Works similarly to Python#range or PHP#range.
reduce(arr, fn):*
Crossbrowser Array.reduce().
reduceRight(arr, fn):*
Crossbrowser Array.reduceRight().
reject(arr, fn, thisObj):Array
Creates a new array with all the elements that do not pass the truth test. Opposite of filter().
remove(arr, item):void
Remove a single item from the array.
removeAll(arr, item):void
Remove all instances of an item from the array.
shuffle(arr):Array
Returns a new Array with items randomly sorted (shuffled). Similar to Ruby Array#shuffle.
some(arr, callback, [thisObj]):Array
Crossbrowser Array.some().
sort(arr, [compareFn]):Array
Returns a sorted Array using the Merge Sort algorithm (stable sort).
split(arr, [segments]):Array
Splits an array into a fixed number of segments.
toLookup(arr, key):Object
Create an object that indexes the items in the array by a key. If key is a function, the key for each value in the resulting object will be the result of calling the function with the value as an argument. Otherwise key specifies the property on each value to use as the key.
union(...arrs):Array
Concat multiple arrays removing duplicates.
unique(arr):Array
Return a new Array of unique items.
xor(arr1, arr2):Array
Exclusive OR. Returns items that are present in a single array.
zip(...arrs):Array
Groups the elements of each array at their corresponding indexes.
contains(list, value):Boolean
Checks if collection contains value.
every(list, callback, [thisObj]):Boolean
Tests whether all values in the collection pass the test implemented by the provided callback.
filter(list, callback, [thisObj]):Array
Filter collection properties.
find(list, callback, [thisObj]):*
Loops through all the values in the collection and returns the first one that passes a truth test (callback).
forEach(list, callback, [thisObj])
Loop through all values of the collection.
map(list, callback, [thisObj]):Array
Returns a new collection where the properties values are the result of calling the callback for each property in the original collection.
max(list, [iterator]):*
Returns maximum value inside collection or use a custom iterator to define how items should be compared.
min(list, [iterator]):*
Returns minimum value inside collection or use a custom iterator to define how items should be compared.
pluck(list, propName):Array
Extract a list of property values.
reduce(list, callback, initial, [thisObj]):*
Apply a function against an accumulator and each value in the collection as to reduce it to a single value.
reject(list, fn, [thisObj]):Array
Creates a new array with all the elements that do not pass the truth test. Opposite of filter().
size(list):Number
Returns the number of values in the collection.
some(list, callback, [thisObj]):Boolean
Tests whether any values in the collection pass the test implemented by the provided callback.
compoundInterest(interestRate, nPeriods, presentValue):Number
Calculates compount interest over
a period.
futureValue(rate, nPeriods, payment[, presentValue, isDue]):Number
Calculate the future value of an investment based on periodic, constant payments at a constant interest rate. (aka.
annuity) - Works
similarly to Microsoft Excel FV() function.
npv(discountRate, values):Number
Calculates the net present value.
payment(rate, nPeriods, presentValue, futureValue, isDue):Number
Calculates the payment for a loan based on constant payments and a constant interest rate. Similar to Microsoft Excel PMT() function. (aka. mortgage or
annuity)
presentValue(rate, nPeriods, payment[, futurevalue, isDue]):Number
Returns the present value of an investment. The present value is the total amount that a series of future payments is worth now (aka.
annuity). - Works
similarly to Microsoft Excel PV() function.
clone(val):*
Deep clone native types like Object, Array, RegExp, Date and primitives.
createObject(parent, [props]):Object
Create Object using prototypal inheritance and setting custom properties.
ctorApply(constructor, args):Object
Do Function.prototype.apply() on a constructor while maintaining prototype chain.
defaults(val, ...defaults):void
Return first value that isn't null or undefined.
inheritPrototype(child, parent):void
Inherit prototype from another Object.
isArguments(val):Boolean
If value is an "Arguments" object.
isArray(val):Boolean
If value is an Array. Uses native ES5 Array.isArray() if available.
isBoolean(val):Boolean
If value is a Boolean.
isDate(val):Boolean
If value is a Date.
isEmpty(val):Boolean
Checks if Array/Object/String is empty.
isFinite(val):Boolean
Checks if value is Finite.
isFunction(val):Boolean
If value is a Function.
isKind(val, kind):Boolean
If value is of "kind". (used internally by some of the isSomething checks).
isNaN(val):Boolean
Check if value is NaN.
isNull(val):Boolean
If value is null.
isNumber(val):Boolean
If value is a Number.
isObject(val):Boolean
If value is an Object.
isRegExp(val):Boolean
If value is a RegExp.
isString(val):Boolean
If value is a String.
isUndefined(val):Boolean
If value is undefined.
kindOf(val):String
Gets kind of value (e.g. "String", "Number", "RegExp", "Null", "Date"). Used internally by isKind() and most of the other isSomething checks.
toArray(val):Array
Convert array-like object into Array or wrap value into Array.
clamp(val, min, max):Number
Clamps value inside range.
countSteps(val, step[, overflow]):Number
Count number of full steps.
inRange(val, min, max[, threshold]):Boolean
Checks if value is inside the range.
isNear(val, target, threshold):Boolean
Check if value is close to target.
lerp(ratio, start, end):Number
Linear interpolation.
loop(val, min, max):Number
Loops value inside range. Will return min if val > max and max if val < min, otherwise it returns val.
map(val, min1, max1, min2, max2):Number
Maps a number from one scale to another.
norm(val, min, max):Number
Gets normalized ratio of value inside range.
snap(val, step):Number
Snap value to full steps. Similar to Math.floor() but can round value to an arbitrary radix.
abbreviate(val[, nDecimalDigits, dictionary]):String
Abbreviate number to thousands (K), millions (M) or billions (B).
currencyFormat(val[, nDecimalDigits, decimalSeparator, thousandsSeparator]):String
Format a number as currency.
enforcePrecision(val, nDecimalDigits):Number
Enforce a specific amount of decimal digits and also fix floating point rounding issues.
MAX_INT:Number
Maximum 32-bit signed integer value. Math.pow(2, 31) - 1
MAX_UINT:Number
Maximum 32-bit unsigned integer value. Math.pow(2, 32) - 1
MIN_INT:Number
Minimum 32-bit signed integer value. Math.pow(2, 31) * -1.
pad(n, minLength):String
Add padding zeros if n.length < minLength.
rol(val, shift):Number
Bitwise circular shift left.
ror(val, shift):Number
Bitwise circular shift right.
sign(val):Number
Returns -1 if value is negative and 1 if value is positive. Useful for multiplications.
toInt(val):Number
"Convert" value into an 32-bit integer. Works like Math.floor if val > 0 and Math.ceil if val < 0.
toUInt(val):Number
"Convert" value into an 32-bit unsigned integer.
toUInt31(val):Number
"Convert" value into an 31-bit unsigned integer (since 1 bit is used for sign).
contains(obj, value):Boolean
Similar to Array/contains. Checks if Object contains value.
deepMixIn(target, ...objects):Object
Mixes objects into the target object, recursively mixing existing child objects and arrays as well.
every(obj, callback, [thisObj]):Boolean
Similar to Array/every. Tests whether all properties in the object pass the test implemented by the provided callback.
fillIn(obj, ...default):Object
Fill in missing properties in object with values from the defaults objects.
filter(obj, callback, [thisObj])
Returns a new object containing all properties where callback returns true, similar to Array/filter. It does not use properties from the object's
prototype.
find(obj, callback, [thisObj])
Loops through all the properties in the Object and returns the first one that passes a truth test (callback), similar to Array/find.
Unlike Array/find, order of iteration is not guaranteed.
forIn(obj, callback[, thisObj])
Iterate over all properties of an Object, similar to Array/forEach.
forOwn(obj, callback[, thisObj])
Iterate over all own properties from an Object, similar to Array/forEach.
get(obj, propName):*
Returns nested property value. Will return undefined if property doesn't exist.
has(obj, propName):Boolean
Checks if object contains a child property. Useful for cases where you need to check if an object contain a nested property. It will get properties
inherited by the prototype.
hasOwn(obj, propName):Boolean
Safer Object.hasOwnProperty. Returns a boolean indicating whether the object has the specified property.
keys(obj):Array
Returns an array of all own enumerable properties found upon a given object. It will use the native Object.keys if present.
map(obj, callback, [thisObj]):Object
Returns a new object where the property values are the result of calling the callback for each property in the original object, similar to Array/map.
merge(...objects):Object
Deep merges objects. Note that objects and properties will be cloned during the process to avoid undesired side effects. It return a new object and won't
affect source objects.
max(obj[, iterator]):*
Returns maximum value inside object or use a custom iterator to define how items should be compared. Similar to Array/max.
min(obj[, iterator]):*
Returns minimum value inside object or use a custom iterator to define how items should be compared. Similar to Array/min.
mixIn(target, ...objects):Object
Combine properties from all the objects into first one.
namespace(obj, propName):Object
Creates an empty object inside namespace if not existent. Will return created object or existing object.
pick(obj, ...keys):Object
Return a copy of the object that contains only the whitelisted keys.
pluck(obj, propName):Object
Extract an object containing property values with keys as they appear in the passed object.
reduce(obj, callback, initial, [thisObj]):*
Similar to Array/reduce.
reject(obj, callback, thisObj):Object
Returns a new object containing all properties where callback returns true, similar to Array/reject. It does not use properties from
the object's prototype. Opposite of filter().
values(obj):Array
Returns an array of all own enumerable properties values found upon a given object.
set(obj, propName, value)
Sets a nested property value.
size(obj):Number
Returns the count of own enumerable properties found upon a given object.
some(obj, callback, [thisObj]):Boolean
Similar to Array/some. Tests whether any properties in the object pass the test implemented by the provided callback.
unset(obj, propName):Boolean
Delete object property if existent and returns a boolean indicating succes. It will also return true if property doesn't exist.
camelCase(str):String
Convert string to "camelCase" text.
contains(str, substring):Boolean
Checks if string contains the given substring.
crop(str, maxChars, [append]):String
Truncate string at full words. Alias to truncate(str, maxChars, append, true);.
endsWith(str, suffix):Boolean
Checks if string ends with specified suffix.
escapeHtml(str):String
Escapes HTML special chars (>, <, &, ", ').
escapeRegExp(str):String
Escape special chars to be used as literals in RegExp constructors.
hyphenate(str):String
Replaces spaces with hyphens, split camelCase text, remove non-word chars, remove accents and convert to lower case.
interpolate(str, replacements[, syntax]):String
String interpolation. Format/replace tokens with object properties.
lowerCase(str):String
"Safer" String.toLowerCase(). (Used internally)
lpad(str, minLength[, char]):String
Pad string from left with char if its' length is smaller than minLen.
ltrim(str):String
Remove white-spaces from beginning of string.
makePath(...args):String
Group arguments as path segments, if any of the args is null or undefined it will be ignored from resulting path. It will also remove duplicate "/".
normalizeLineBreaks(str, [lineBreak]):String
Normalize line breaks to a single format. Defaults to Unix \n.
pascalCase(str):String
Convert string to "PascalCase" text.
properCase(str):String
UPPERCASE first char of each word, lowercase other chars.
removeNonASCII(str):String
Remove non-printable ASCII chars.
removeNonWord(str):String
Remove non-word chars.
repeat(str, n):String
Repeat string n-times.
replaceAccents(str):String
Replaces all accented chars with regular ones.
rpad(str, minLength[, char]):String
Pad string from right with char if its' length is smaller than minLen.
rtrim(str):String
Remove white-spaces from end of string.
sentenceCase(str):String
UPPERCASE first char of each sentence and lowercase other chars.
stripHtmlTags(str):String
Remove HTML/XML tags from string.
startsWith(str, prefix):Boolean
Checks if string starts with specified prefix.
slugify(str[, delimeter]):String
Convert to lower case, remove accents, remove non-word chars and replace spaces with the delimeter. The default delimeter is a hyphen.
trim(str):String
Remove white-spaces from beginning and end of string.
truncate(str, maxChars, [append], [onlyFullWords]):String
Limit number of chars. Returned string length will be <= maxChars.
typecast(str):*
Parses string and convert it into a native value.
unCamelCase(str):String
Add space between camelCase text and convert first char of each word to lower case.
underscore(str):String
Replaces spaces with underscores, split camelCase text, remove non-word chars, remove accents and convert to lower case.
unescapeHtml(str):String
Unescapes HTML special chars (>, <, &, ", ').
unhyphenate(str):String
Replaces hyphens with spaces. (only hyphens between word chars)
upperCase(str):String
"Safer" String.toUpperCase(). (Used internally)