summaryrefslogtreecommitdiff
path: root/lib/dojo/_base/array.js
diff options
context:
space:
mode:
Diffstat (limited to 'lib/dojo/_base/array.js')
-rw-r--r--lib/dojo/_base/array.js39
1 files changed, 20 insertions, 19 deletions
diff --git a/lib/dojo/_base/array.js b/lib/dojo/_base/array.js
index 26fa1900d..57cea4229 100644
--- a/lib/dojo/_base/array.js
+++ b/lib/dojo/_base/array.js
@@ -1,5 +1,5 @@
/*
- Copyright (c) 2004-2010, The Dojo Foundation All Rights Reserved.
+ Copyright (c) 2004-2011, The Dojo Foundation All Rights Reserved.
Available via Academic Free License >= 2.1 OR the modified BSD license.
see: http://dojotoolkit.org/license for details
*/
@@ -7,13 +7,14 @@
if(!dojo._hasResource["dojo._base.array"]){ //_hasResource checks added by build. Do not use _hasResource directly in your code.
dojo._hasResource["dojo._base.array"] = true;
-dojo.require("dojo._base.lang");
dojo.provide("dojo._base.array");
+dojo.require("dojo._base.lang");
+
(function(){
var _getParts = function(arr, obj, cb){
- return [
- (typeof arr == "string") ? arr.split("") : arr,
+ return [
+ (typeof arr == "string") ? arr.split("") : arr,
obj || dojo.global,
// FIXME: cache the anonymous functions we create here?
(typeof cb == "string") ? new Function("item", "index", "array", cb) : cb
@@ -32,7 +33,7 @@ dojo.provide("dojo._base.array");
};
dojo.mixin(dojo, {
- indexOf: function( /*Array*/ array,
+ indexOf: function( /*Array*/ array,
/*Object*/ value,
/*Integer?*/ fromIndex,
/*Boolean?*/ findLast){
@@ -41,7 +42,7 @@ dojo.provide("dojo._base.array");
// 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
+ // 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
@@ -66,7 +67,7 @@ dojo.provide("dojo._base.array");
// 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
+ // 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
@@ -85,7 +86,7 @@ dojo.provide("dojo._base.array");
// thisObject:
// may be used to scope the call to callback
// description:
- // This function corresponds to the JavaScript 1.6 Array.forEach() method, with one difference: when
+ // 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:
@@ -108,21 +109,21 @@ dojo.provide("dojo._base.array");
// | );
// example:
// | // use a scoped object member as the callback
- // |
+ // |
// | var obj = {
- // | prefix: "logged via obj.callback:",
+ // | 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 ],
@@ -135,7 +136,7 @@ dojo.provide("dojo._base.array");
// FIXME: there are several ways of handilng thisObject. Is
// dojo.global always the default context?
var _p = _getParts(arr, thisObject, callback); arr = _p[0];
- for(var i=0,l=arr.length; i<l; ++i){
+ for(var i=0,l=arr.length; i<l; ++i){
_p[2].call(_p[1], arr[i], i, arr);
}
},
@@ -152,7 +153,7 @@ dojo.provide("dojo._base.array");
// thisObject:
// may be used to scope the call to callback
// description:
- // This function corresponds to the JavaScript 1.6 Array.every() method, with one difference: when
+ // 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:
@@ -161,7 +162,7 @@ dojo.provide("dojo._base.array");
// | // returns false
// | dojo.every([1, 2, 3, 4], function(item){ return item>1; });
// example:
- // | // returns true
+ // | // returns true
// | dojo.every([1, 2, 3, 4], function(item){ return item>0; });
return everyOrSome(true, arr, callback, thisObject); // Boolean
},
@@ -178,7 +179,7 @@ dojo.provide("dojo._base.array");
// thisObject:
// may be used to scope the call to callback
// description:
- // This function corresponds to the JavaScript 1.6 Array.some() method, with one difference: when
+ // 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:
@@ -205,7 +206,7 @@ dojo.provide("dojo._base.array");
// thisObject:
// may be used to scope the call to callback
// description:
- // This function corresponds to the JavaScript 1.6 Array.map() method, with one difference: when
+ // 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:
@@ -236,9 +237,9 @@ dojo.provide("dojo._base.array");
// thisObject:
// may be used to scope the call to callback
// description:
- // This function corresponds to the JavaScript 1.6 Array.filter() method, with one difference: when
+ // 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.
+ // 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: