Warning: Use of undefined constant Symbol - assumed 'Symbol' (this will throw an Error in a future version of PHP) in /mnt/new-ebs/workbench-106550/lib/dojo/util/docscripts/lib/parser2/dojo2.inc on line 215 Warning: Use of undefined constant JavaScriptSymbol - assumed 'JavaScriptSymbol' (this will throw an Error in a future version of PHP) in /mnt/new-ebs/workbench-106550/lib/dojo/util/docscripts/lib/parser2/dojo2.inc on line 215

dojo/_base/array.js

  • Provides:

    • dojo._base.array
  • Requires:

    • dojo.lib.kernel in common
    • dojo._base.lang in common
  • dojo.indexOf

    • parameters:
      • array: (typeof Array)
      • value: (typeof Object)
      • fromIndex: (typeof Integer)
      • findLast: (typeof Boolean)
    • returns
      Number
    • summary
      locates the first index of the provided value in the
      passed array. If the value is not found, -1 is returned.
    • description
      This method corresponds to the JavaScript 1.6 Array.indexOf method, with one difference: when
      run over sparse arrays, the Dojo function invokes the callback for every index whereas JavaScript
      1.6's indexOf skips the holes in the sparse array.
      For details on this method, see:
      https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Objects/Array/indexOf
    • type
      Function
  • dojo.lastIndexOf

    • parameters:
      • array: (typeof Array)
      • value: (typeof Object)
      • fromIndex: (typeof Integer)
    • returns
      Number
    • summary
      locates the last index of the provided value in the passed
      array. If the value is not found, -1 is returned.
    • description
      This method corresponds to the JavaScript 1.6 Array.lastIndexOf method, with one difference: when
      run over sparse arrays, the Dojo function invokes the callback for every index whereas JavaScript
      1.6's lastIndexOf skips the holes in the sparse array.
      For details on this method, see:
      https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Objects/Array/lastIndexOf
    • type
      Function
  • dojo.forEach

    • parameters:
      • arr: (typeof Array|String)
        the array to iterate over. If a string, operates on individual characters.
      • callback: (typeof Function|String)
        a function is invoked with three arguments: item, index, and array
      • thisObject: (typeof Object)
        may be used to scope the call to callback
    • summary
      for every item in arr, callback is invoked. Return values are ignored.
      If you want to break out of the loop, consider using dojo.every() or dojo.some().
      forEach does not allow breaking out of the loop over the items in arr.
    • description
      This function corresponds to the JavaScript 1.6 Array.forEach() method, with one difference: when
      run over sparse arrays, this implemenation passes the "holes" in the sparse array to
      the callback function with a value of undefined. JavaScript 1.6's forEach skips the holes in the sparse array.
      For more details, see:
      https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Objects/Array/forEach
    • example
      	// log out all members of the array:
      	dojo.forEach(
      		[ "thinger", "blah", "howdy", 10 ],
      		function(item){
      			console.log(item);
      		}
      	);
    • example
      	// log out the members and their indexes
      	dojo.forEach(
      		[ "thinger", "blah", "howdy", 10 ],
      		function(item, idx, arr){
      			console.log(item, "at index:", idx);
      		}
      	);
    • example
      	// use a scoped object member as the callback
      
      	var obj = {
      		prefix: "logged via obj.callback:",
      		callback: function(item){
      			console.log(this.prefix, item);
      		}
      	};
      
      	// specifying the scope function executes the callback in that scope
      	dojo.forEach(
      		[ "thinger", "blah", "howdy", 10 ],
      		obj.callback,
      		obj
      	);
      
      	// alternately, we can accomplish the same thing with dojo.hitch()
      	dojo.forEach(
      		[ "thinger", "blah", "howdy", 10 ],
      		dojo.hitch(obj, "callback")
      	);
    • type
      Function
  • dojo.every

    • parameters:
      • arr: (typeof Array|String)
        the array to iterate on. If a string, operates on individual characters.
      • callback: (typeof Function|String)
        a function is invoked with three arguments: item, index,
        and array and returns true if the condition is met.
      • thisObject: (typeof Object)
        may be used to scope the call to callback
    • returns
      Boolean
    • summary
      Determines whether or not every item in arr satisfies the
      condition implemented by callback.
    • description
      This function corresponds to the JavaScript 1.6 Array.every() method, with one difference: when
      run over sparse arrays, this implemenation passes the "holes" in the sparse array to
      the callback function with a value of undefined. JavaScript 1.6's every skips the holes in the sparse array.
      For more details, see:
      https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Objects/Array/every
    • example
      	// returns false
      	dojo.every([1, 2, 3, 4], function(item){ return item>1; });
    • example
      	// returns true
      	dojo.every([1, 2, 3, 4], function(item){ return item>0; });
    • type
      Function
  • dojo.some

    • parameters:
      • arr: (typeof Array|String)
        the array to iterate over. If a string, operates on individual characters.
      • callback: (typeof Function|String)
        a function is invoked with three arguments: item, index,
        and array and returns true if the condition is met.
      • thisObject: (typeof Object)
        may be used to scope the call to callback
    • returns
      Boolean
    • summary
      Determines whether or not any item in arr satisfies the
      condition implemented by callback.
    • description
      This function corresponds to the JavaScript 1.6 Array.some() method, with one difference: when
      run over sparse arrays, this implemenation passes the "holes" in the sparse array to
      the callback function with a value of undefined. JavaScript 1.6's some skips the holes in the sparse array.
      For more details, see:
      https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Objects/Array/some
    • example
      	// is true
      	dojo.some([1, 2, 3, 4], function(item){ return item>1; });
    • example
      	// is false
      	dojo.some([1, 2, 3, 4], function(item){ return item<1; });
    • type
      Function
  • dojo.map

    • parameters:
      • arr: (typeof Array|String)
        the array to iterate on. If a string, operates on
        individual characters.
      • callback: (typeof Function|String)
        a function is invoked with three arguments, (item, index,
        array),  and returns a value
      • thisObject: (typeof Function)
        may be used to scope the call to callback
    • returns
      Array
    • summary
      applies callback to each element of arr and returns
      an Array with the results
    • description
      This function corresponds to the JavaScript 1.6 Array.map() method, with one difference: when
      run over sparse arrays, this implemenation passes the "holes" in the sparse array to
      the callback function with a value of undefined. JavaScript 1.6's map skips the holes in the sparse array.
      For more details, see:
      https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Objects/Array/map
    • example
      	// returns [2, 3, 4, 5]
      	dojo.map([1, 2, 3, 4], function(item){ return item+1 });
    • type
      Function
  • dojo.filter

    • parameters:
      • arr: (typeof Array)
        the array to iterate over.
      • callback: (typeof Function|String)
        a function that is invoked with three arguments (item,
        index, array). The return of this function is expected to
        be a boolean which determines whether the passed-in item
        will be included in the returned array.
      • thisObject: (typeof Object)
        may be used to scope the call to callback
    • returns
      Array
    • summary
      Returns a new Array with those items from arr that match the
      condition implemented by callback.
    • description
      This function corresponds to the JavaScript 1.6 Array.filter() method, with one difference: when
      run over sparse arrays, this implemenation passes the "holes" in the sparse array to
      the callback function with a value of undefined. JavaScript 1.6's filter skips the holes in the sparse array.
      For more details, see:
      https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Objects/Array/filter
    • example
      	// returns [2, 3, 4]
      	dojo.filter([1, 2, 3, 4], function(item){ return item>1; });
    • type
      Function
  • dojo._base.array

    • type
      Object
  • dojo._base

    • type
      Object
  • dojo

    • type
      Object