Tour API Demos Download Tests
Aperture version 1.0
Generated by: JsDoc Toolkit 2.4.0

Namespace aperture.util

Aperture makes use of a number of JavaScript utility functions that are exposed through this namespace for general use.

Namespace Summary
Constructor Attributes Constructor Name and Description
 

Method Summary

Namespace Detail

aperture.util
Parameters:
ns

Method Detail

  • <static> {Function} aperture.util.bind(function, object)
    Bind a function to an object, meaning that whenever the function is called, the value of this will be the object. Optionally, bind initial argument values to the function, also known as partial application or 'curry'. This method delegates to a native implementation if ECMAScript 5 is present.
    Parameters:
    {Function} function
    the function to wrap, with bound context and, optionally, arguments.
    {Object} object
    the object to bind to be the value of this when the wrapped function is called.
    arguments... Optional
    the optional argument values to prepend when the wrapped function is called, which will be followed by any arguments supplied by the caller of the bound function returned here.
    Returns:
    {Function} the bound function.
  • <static> {Object} aperture.util.extend(destination, source)
    Copy all of the properties in the source object(s) over to the destination object, in order.
    Parameters:
    {Object} destination
    the object to extend.
    {Object} source
    one or more source objects (supplied as additional arguments) with properties to add to the destination object.
    Returns:
    {Object} the destination object
  • <static> {Array} aperture.util.filter(collection, test, context)
    Looks through each value in the collection, returning an array of all the values that pass a truth test. For arrays this method delegates to the native ECMAScript 5 array filter method, if present.
    Parameters:
    {Array|Object|arguments} collection
    the collection to search.
    {Function} test
    the function called for each item to test for inclusion, with the three arguments (item, indexOrKey, collection)
    context Optional
    the optional calling context to use, accessible from the test as this.
    Returns:
    {Array} an array containing the subset that passed the filter test.
  • <static> aperture.util.find(collection, test, context)
    Looks through each value in the collection, returning the first one that passes a truth test.
    Parameters:
    {Array|Object|arguments} collection
    the collection to search.
    {Function} test
    the function called for each item that tests for fulfillment, called with the three arguments (item, indexOrKey, collection)
    context Optional
    the optional calling context to use, accessible from the test as this.
    Returns:
    The item found, or undefined.
  • <static> aperture.util.forEach(collection, operation, context)
    Calls a function for each item in a collection. If ECMAScript 5 is supported by the runtime execution environment (e.g. browser) this method delegates to a native implementation.
    Parameters:
    {Array|Object|arguments} collection
    the collection to iterate through.
    {Function} operation
    the function to call for each item in the collection, with the three arguments (item, indexOrKey, collection).
    context Optional
    the optional calling context to use, accessible from the operation as this.
  • <static> aperture.util.forEachUntil(collection, operation, until, context)
    Calls a function for each item in a collection, until the return value === the until condition.
    Parameters:
    {Array|Object|arguments} collection
    the collection to iterate through.
    {Function} operation
    the function to call for each item in the collection, with the three arguments (item, indexOrKey, collection).
    until Optional, Default: true
    the return value to test for when deciding whether to break iteration.
    context Optional
    the optional calling context to use, accessible from the operation as this.
    Returns:
    the return value of the last function iteration.
  • <static> aperture.util.has(collection, value)
    Looks through a collection, returning true if it includes the specified value.
    Parameters:
    {Array|Object|arguments} collection
    the collection to search.
    value
    the value to look for using the === test.
    Returns:
    True if found, else false.
  • <static> aperture.util.hasAll(collection, values)
    Looks through a collection, returning true if it contains all of the specified values. If there are no values to look for this function returns false.
    Parameters:
    {Array|Object|arguments} collection
    the collection to search.
    {Array} values
    the values to look for using the === test.
    Returns:
    True if any are found, else false.
  • <static> aperture.util.hasAny(collection, values)
    Looks through a collection, returning true if it contains any of the specified values.
    Parameters:
    {Array|Object|arguments} collection
    the collection to search.
    {Array} values
    the values to look for using the === test.
    Returns:
    True if any are found, else false.
  • <static> {Number} aperture.util.indexOf(array, item)
    Returns the index at which value can be found in the array, or -1 if not present. Uses the native array indexOf function if present.
    Parameters:
    {Array} array
    the array to search.
    item
    the item to look for, using the === check.
    Returns:
    {Number} the index of the item if found, otherwise -1.
  • <static> aperture.util.isArray(candidate)
    Returns true if argument is an array. This method delegates to a native implementation if ECMAScript 5 is present.
    Parameters:
    candidate
    the candidate to test.
    Returns:
    true if of the queried type
  • <static> aperture.util.isFunction(candidate)
    Returns true if argument appears to be a function.
    Parameters:
    candidate
    the candidate to test.
    Returns:
    true if of the queried type
  • <static> aperture.util.isNumber(candidate)
    Returns true if argument appears to be a number.
    Parameters:
    candidate
    the candidate to test.
    Returns:
    true if of the queried type
  • <static> aperture.util.isObject(candidate)
    Returns true if argument appears to be an object.
    Parameters:
    candidate
    the candidate to test.
    Returns:
    true if of the queried type
  • <static> aperture.util.isString(candidate)
    Returns true if argument appears to be a string.
    Parameters:
    candidate
    the candidate to test.
    Returns:
    true if of the queried type
  • <static> {Array} aperture.util.map(collection, transformation, context)
    Produces a new array of values by mapping each item in the collection through a transformation function. For arrays this method delegates to the native ECMAScript 5 array map method, if present.
    Parameters:
    {Array|Object|arguments} collection
    the collection to map.
    {Function} transformation
    the function called for each item that returns a transformed value, called with the three arguments (item, indexOrKey, collection)
    context Optional
    the optional calling context to use, accessible from the transformation as this.
    Returns:
    {Array} a new array containing the transformed values.
  • <static> {Object} aperture.util.viewOf(obj)
    Instantiates a new object whose JavaScript prototype is the object passed in.
    Parameters:
    {Object} obj
    the prototype for the new object.
    Returns:
    {Object} a new view of the object passed in.
  • <static> {Array} aperture.util.without(array, value, etc)
    Returns a copy of the array with the specified values removed.
    Parameters:
    {Array} array
    the array to remove from.
    value
    the item to remove, identified using the === check.
    etc
    additional items to remove, as additional arguments.
    Returns:
    {Array} a new array with values removed