Skip to content

Fix #2235: Documentation: method name order #2343

Closed
wants to merge 1 commit into from
View
632 Docs/Types/Array.md
@@ -8,6 +8,39 @@ A collection of Array methods and functions.
- [MDC Array][]
+Function: Array.clone {#Array:Array-clone}
+------------------------------------
+
+Returns a copy of the passed array.
+
+### Syntax:
+
+ var clone = Array.clone(myArray);
+
+### Arguments:
+
+1. myArray - (*array*) The array you wish to copy.
+
+### Returns:
+
+* (*array*) a copy of the passed array.
+
+### Example:
+
+ var myArray = ['red', 'blue', 'green'];
+ var otherArray = Array.clone(myArray);
+
+ var myArray[0] = 'yellow';
+
+ alert(myArray[0]); // alerts 'yellow'
+ alert(otherArray[0]) // alerts 'red'
+
+### Notes:
+
+This is an array-specific equivalent of *$unlink* from MooTools 1.2.
+
+
+
Function: Array.each {#Array:Array-each}
----------------------------------
@@ -51,65 +84,161 @@ This is an array-specific equivalent of *$each* from MooTools 1.2.
-Function: Array.clone {#Array:Array-clone}
-------------------------------------
+Function: Array.from {#Array:Array-from}
+----------------------------------
-Returns a copy of the passed array.
+Converts the argument passed in to an array if it is defined and not already an array.
### Syntax:
- var clone = Array.clone(myArray);
+ var splatted = Array.from(obj);
### Arguments:
-1. myArray - (*array*) The array you wish to copy.
+1. obj - (*mixed*) Any type of variable.
### Returns:
-* (*array*) a copy of the passed array.
+* (*array*) If the variable passed in is an array, returns the array. Otherwise, returns an array with the only element being the variable passed in.
### Example:
- var myArray = ['red', 'blue', 'green'];
- var otherArray = Array.clone(myArray);
+ Array.from('hello'); // returns ['hello'].
+ Array.from(['a', 'b', 'c']); // returns ['a', 'b', 'c'].
- var myArray[0] = 'yellow';
+### Notes:
- alert(myArray[0]); // alerts 'yellow'
- alert(otherArray[0]) // alerts 'red'
+This is equivalent to *$splat* from MooTools 1.2, with the exception of Array-like Objects such as NodeList or FileList which `Array.from` does transform in
+Arrays and `$splat` not.
+
+
+
+Array method: append {#Array:append}
+------------------------------
+
+Appends the passed array to the end of the current array.
+
+### Syntax:
+
+ var myArray = myArray.append(otherArray);
+
+### Arguments:
+
+1. otherArray - (*array*) The array containing values you wish to append.
+
+### Returns:
+
+* (*array*) The original array including the new values.
+
+### Examples:
+
+ var myOtherArray = ['green', 'yellow'];
+ ['red', 'blue'].append(myOtherArray); // returns ['red', 'blue', 'green', 'yellow'];
+ myOtheArray; // is now ['red', 'blue', 'green', 'yellow'];
+
+ [0, 1, 2].append([3, [4]]); // [0, 1, 2, 3, [4]]
### Notes:
-This is an array-specific equivalent of *$unlink* from MooTools 1.2.
+This is an array-specific equivalent of *$extend* from MooTools 1.2.
+Array method: associate {#Array:associate}
+------------------------------------
-Function: Array.from {#Array:Array-from}
+Creates an object with key-value pairs based on the array of keywords passed in and the current content of the array.
+
+### Syntax:
+
+ var associated = myArray.associate(obj);
+
+### Arguments:
+
+1. obj - (*array*) Its items will be used as the keys of the object that will be created.
+
+### Returns:
+
+* (*object*) The new associated object.
+
+### Examples:
+
+ var animals = ['Cow', 'Pig', 'Dog', 'Cat'];
+ var sounds = ['Moo', 'Oink', 'Woof', 'Miao'];
+ sounds.associate(animals);
+ // returns {'Cow': 'Moo', 'Pig': 'Oink', 'Dog': 'Woof', 'Cat': 'Miao'}
+
+
+
+Array method: clean {#Array:clean}
+----------------------------
+
+Creates a new array with all of the elements of the array which are defined (i.e. not null or undefined).
+
+### Syntax:
+
+ var cleanedArray = myArray.clean();
+
+### Returns:
+
+* (*array*) The new filtered array.
+
+### Examples:
+
+ var myArray = [null, 1, 0, true, false, 'foo', undefined, ''];
+ myArray.clean() // returns [1, 0, true, false, 'foo', '']
+
+
+Array method: combine {#Array:combine}
+--------------------------------
+
+Combines an array with all the items of another. Does not allow duplicates and is case and type sensitive.
+
+### Syntax:
+
+ myArray.combine(array);
+
+### Arguments:
+
+1. array - (*array*) The array whose items should be combined into this array.
+
+### Returns:
+
+* (*array*) This array combined with the new items.
+
+### Examples:
+
+ var animals = ['Cow', 'Pig', 'Dog'];
+ animals.combine(['Cat', 'Dog']); //animals = ['Cow', 'Pig', 'Dog', 'Cat'];
+
+
+
+Array method: contains {#Array:contains}
----------------------------------
-Converts the argument passed in to an array if it is defined and not already an array.
+Tests an array for the presence of an item.
### Syntax:
- var splatted = Array.from(obj);
+ var inArray = myArray.contains(item[, from]);
### Arguments:
-1. obj - (*mixed*) Any type of variable.
+1. item - (*object*) The item to search for in the array.
+2. from - (*number*, optional: defaults to 0) The index of the array at which to begin the search.
### Returns:
-* (*array*) If the variable passed in is an array, returns the array. Otherwise, returns an array with the only element being the variable passed in.
+* (*boolean*) If the array contains the item specified, returns true. Otherwise, returns false.
-### Example:
+### Examples:
- Array.from('hello'); // returns ['hello'].
- Array.from(['a', 'b', 'c']); // returns ['a', 'b', 'c'].
+ ['a', 'b', 'c'].contains('a'); // returns true
+ ['a', 'b', 'c'].contains('d'); // returns false
-### Notes:
+### See Also:
+
+- [MDC Array:indexOf][]
-This is equivalent to *$splat* from MooTools 1.2, with the exception of Array-like Objects such as NodeList or FileList which `Array.from` does transform in
-Arrays and `$splat` not.
@@ -158,38 +287,51 @@ Calls a function for each element in the array.
+Array method: empty {#Array:empty}
+----------------------------
+
+Empties an array.
+### Syntax:
+ myArray.empty();
-Array method: invoke {#Array:invoke}
---------------------------
+### Returns:
+
+* (*array*) This array, emptied.
+
+### Examples:
+
+ var myArray = ['old', 'data'];
+ myArray.empty(); //myArray is now []
-Returns an array with the named method applied to the array's contents.
+
+
+
+Array method: erase {#Array:erase}
+----------------------------
+
+Removes all occurrences of an item from the array.
### Syntax:
- var arr = myArray.invoke(method[, arg, arg, arg ...])
+ myArray.erase(item);
### Arguments:
-1. method - (*string*) The method to apply to each item in the array.
-2. arg - (*mixed*) Any number of arguments to pass to the named method.
+1. item - (*object*) The item to search for in the array.
### Returns:
-* (*array*) A new array containing the results of the applied method.
+* (*array*) This array with all occurrences of the item removed.
-### Example:
+### Examples:
- var foo = [4, 8, 15, 16, 23, 42];
- var bar = foo.invoke('limit', 10, 30); //bar is now [10, 10, 15, 16, 23, 30]
+ ['Cow', 'Pig', 'Dog', 'Cat', 'Dog'].erase('Dog') // returns ['Cow', 'Pig', 'Cat']
+ ['Cow', 'Pig', 'Dog'].erase('Cat') // returns ['Cow', 'Pig', 'Dog']
-### Notes:
-The method that is invoked is a method of each of the items.
-If the method does not exist, then an error will be thrown. For example:
- [0, false, 'string'].invoke('limit', 0, 10); // throws an error!
Array method: every {#Array:every}
----------------------------
@@ -235,6 +377,7 @@ This method is provided only for browsers without native [Array:every][] support
+
Array method: filter {#Array:filter}
------------------------------
@@ -278,411 +421,263 @@ This method is provided only for browsers without native [Array:filter][] suppor
-Array method: clean {#Array:clean}
-----------------------------
+Array method: flatten {#Array:flatten}
+--------------------------------
-Creates a new array with all of the elements of the array which are defined (i.e. not null or undefined).
+Flattens a multidimensional array into a single array.
### Syntax:
- var cleanedArray = myArray.clean();
+ myArray.flatten();
### Returns:
-* (*array*) The new filtered array.
+* (*array*) A new flat array.
### Examples:
- var myArray = [null, 1, 0, true, false, 'foo', undefined, ''];
- myArray.clean() // returns [1, 0, true, false, 'foo', '']
+ var myArray = [1,2,3,[4,5, [6,7]], [[[8]]]];
+ var newArray = myArray.flatten(); //newArray is [1,2,3,4,5,6,7,8]
-Array method: indexOf {#Array:indexOf}
+Array method: getLast {#Array:getLast}
--------------------------------
-Returns the index of the first element within the array equal to the specified value, or -1 if the value is not found.
-This method is provided only for browsers without native [Array:indexOf][] support.
+Returns the last item from the array.
### Syntax:
- var index = myArray.indexOf(item[, from]);
+ myArray.getLast();
### Returns:
-* (*number*) The index of the first element within the array equal to the specified value. If not found, returns -1.
+* (*mixed*) The last item in this array.
+* (*null*) If this array is empty, returns null.
-### Arguments:
+### Examples:
-1. item - (*object*) The item to search for in the array.
-2. from - (*number*, optional: defaults to 0) The index of the array at which to begin the search.
+ ['Cow', 'Pig', 'Dog', 'Cat'].getLast(); // returns 'Cat'
-### Examples:
- ['apple', 'lemon', 'banana'].indexOf('lemon'); // returns 1
- ['apple', 'lemon'].indexOf('banana'); // returns -1
-### See Also:
+Array method: getRandom {#Array:getRandom}
+------------------------------------
-- [MDC Array:indexOf][]
+Returns a random item from the array.
+### Syntax:
-
-Array method: map {#Array:map}
-------------------------
-
-Creates a new array with the results of calling a provided function on every element in the array.
-This method is provided only for browsers without native [Array:map][] support.
-
-### Syntax:
-
- var mappedArray = myArray.map(fn[, bind]);
-
-### Arguments:
-
-1. fn - (*function*) The function to produce an element of the new Array from an element of the current one.
-2. bind - (*object*, optional) The object to use as 'this' in the function. For more information see [Function:bind][].
-
-#### Argument: fn
-
-##### Syntax:
-
- fn(item, index, array)
-
-##### Arguments:
-
-1. item - (*mixed*) The current item in the array.
-2. index - (*number*) The current item's index in the array.
-3. array - (*array*) The actual array.
+ myArray.getRandom();
### Returns:
-* (*array*) The new mapped array.
+* (*mixed*) A random item from this array. If this array is empty, returns null.
### Examples:
- var timesTwo = [1, 2, 3].map(function(item, index){
- return item * 2;
- }); //timesTwo = [2, 4, 6];
-
-### See Also:
+ ['Cow', 'Pig', 'Dog', 'Cat'].getRandom(); // returns one of the items
-- [MDC Array:map][]
-Array method: some {#Array:some}
---------------------------
+Array method: hexToRgb {#Array:hexToRgb}
+----------------------------------
-Returns true if at least one element in the array satisfies the provided testing function.
-This method is provided only for browsers without native [Array:some][] support.
+Converts an hexadecimal color value to RGB. Input array must be the following hexadecimal color format.
+\['FF', 'FF', 'FF'\]
### Syntax:
- var somePassed = myArray.some(fn[, bind]);
-
-### Returns:
-
-* (*boolean*) If at least one element in the array satisfies the provided testing function returns true. Otherwise, returns false.
+ myArray.hexToRgb([array]);
### Arguments:
-1. fn - (*function*) The function to test for each element. This function is passed the item and its index in the array.
-2. bind - (*object*, optional) The object to use as 'this' in the function. For more information see [Function:bind][].
-
-#### Argument: fn
-
-##### Syntax:
-
- fn(item, index, array)
+1. array - (*boolean*, optional) If true is passed, will output an array (e.g. \[255, 51, 0\]) instead of a string (e.g. "rgb(255, 51, 0)").
-##### Arguments:
+### Returns:
-1. item - (*mixed*) The current item in the array.
-2. index - (*number*) The current item's index in the array.
-3. array - (*array*) The actual array.
+* (*string*) A string representing the color in RGB.
+* (*array*) If the array flag is set, an array will be returned instead.
### Examples:
- var isAnyBigEnough = [10, 4, 25, 100].some(function(item, index){
- return item > 20;
- }); // isAnyBigEnough = true
+ ['11', '22', '33'].hexToRgb(); // returns 'rgb(17, 34, 51)'
+ ['11', '22', '33'].hexToRgb(true); // returns [17, 34, 51]
### See Also:
-- [MDC Array:some][]
+- [String:hexToRgb][]
-Array method: associate {#Array:associate}
-------------------------------------
+Array method: include {#Array:include}
+--------------------------------
-Creates an object with key-value pairs based on the array of keywords passed in and the current content of the array.
+Pushes the passed element into the array if it's not already present (case and type sensitive).
### Syntax:
- var associated = myArray.associate(obj);
+ myArray.include(item);
### Arguments:
-1. obj - (*array*) Its items will be used as the keys of the object that will be created.
+1. item - (*object*) The item that should be added to this array.
### Returns:
-* (*object*) The new associated object.
+* (*array*) This array with the new item included.
### Examples:
- var animals = ['Cow', 'Pig', 'Dog', 'Cat'];
- var sounds = ['Moo', 'Oink', 'Woof', 'Miao'];
- sounds.associate(animals);
- // returns {'Cow': 'Moo', 'Pig': 'Oink', 'Dog': 'Woof', 'Cat': 'Miao'}
-
-
-
-Array method: link {#Array:link}
---------------------------
-
-Accepts an object of key / function pairs to assign values.
-
-### Syntax:
-
- var result = myArray.link(object);
+ ['Cow', 'Pig', 'Dog'].include('Cat'); // returns ['Cow', 'Pig', 'Dog', 'Cat']
+ ['Cow', 'Pig', 'Dog'].include('Dog'); // returns ['Cow', 'Pig', 'Dog']
-### Arguments:
+### Notes:
-1. object - (*object*) An object containing key / function pairs must be passed to be used as a template for associating values with the different keys.
+If you want to push the passed element even if it's already present, use
+the vanilla javascript:
-### Returns:
+ myArray.push(item);
-* (*object*) The new associated object.
-### Examples:
- var el = document.createElement('div');
- var arr2 = [100, 'Hello', {foo: 'bar'}, el, false];
- arr2.link({
- myNumber: Type.isNumber,
- myElement: Type.isElement,
- myObject: Type.isObject,
- myString: Type.isString,
- myBoolean: function(obj){ return obj != null; }
- });
- // returns {myNumber: 100, myElement: el, myObject: {foo: 'bar'}, myString: 'Hello', myBoolean: false}
+Array method: indexOf {#Array:indexOf}
+--------------------------------
+Returns the index of the first element within the array equal to the specified value, or -1 if the value is not found.
+This method is provided only for browsers without native [Array:indexOf][] support.
-Array method: contains {#Array:contains}
-----------------------------------
+### Syntax:
-Tests an array for the presence of an item.
+ var index = myArray.indexOf(item[, from]);
-### Syntax:
+### Returns:
- var inArray = myArray.contains(item[, from]);
+* (*number*) The index of the first element within the array equal to the specified value. If not found, returns -1.
### Arguments:
1. item - (*object*) The item to search for in the array.
2. from - (*number*, optional: defaults to 0) The index of the array at which to begin the search.
-### Returns:
-
-* (*boolean*) If the array contains the item specified, returns true. Otherwise, returns false.
-
### Examples:
- ['a', 'b', 'c'].contains('a'); // returns true
- ['a', 'b', 'c'].contains('d'); // returns false
+ ['apple', 'lemon', 'banana'].indexOf('lemon'); // returns 1
+ ['apple', 'lemon'].indexOf('banana'); // returns -1
### See Also:
- [MDC Array:indexOf][]
-Array method: append {#Array:append}
-------------------------------
+Array method: invoke {#Array:invoke}
+--------------------------
-Appends the passed array to the end of the current array.
+Returns an array with the named method applied to the array's contents.
### Syntax:
- var myArray = myArray.append(otherArray);
+ var arr = myArray.invoke(method[, arg, arg, arg ...])
### Arguments:
-1. otherArray - (*array*) The array containing values you wish to append.
+1. method - (*string*) The method to apply to each item in the array.
+2. arg - (*mixed*) Any number of arguments to pass to the named method.
### Returns:
-* (*array*) The original array including the new values.
-
-### Examples:
+* (*array*) A new array containing the results of the applied method.
- var myOtherArray = ['green', 'yellow'];
- ['red', 'blue'].append(myOtherArray); // returns ['red', 'blue', 'green', 'yellow'];
- myOtheArray; // is now ['red', 'blue', 'green', 'yellow'];
+### Example:
- [0, 1, 2].append([3, [4]]); // [0, 1, 2, 3, [4]]
+ var foo = [4, 8, 15, 16, 23, 42];
+ var bar = foo.invoke('limit', 10, 30); //bar is now [10, 10, 15, 16, 23, 30]
### Notes:
-This is an array-specific equivalent of *$extend* from MooTools 1.2.
-
-
-
-Array method: getLast {#Array:getLast}
---------------------------------
-
-Returns the last item from the array.
-
-### Syntax:
-
- myArray.getLast();
-
-### Returns:
-
-* (*mixed*) The last item in this array.
-* (*null*) If this array is empty, returns null.
-
-### Examples:
-
- ['Cow', 'Pig', 'Dog', 'Cat'].getLast(); // returns 'Cat'
-
-
-
-Array method: getRandom {#Array:getRandom}
-------------------------------------
-
-Returns a random item from the array.
-
-### Syntax:
-
- myArray.getRandom();
-
-### Returns:
-
-* (*mixed*) A random item from this array. If this array is empty, returns null.
+The method that is invoked is a method of each of the items.
+If the method does not exist, then an error will be thrown. For example:
-### Examples:
+ [0, false, 'string'].invoke('limit', 0, 10); // throws an error!
- ['Cow', 'Pig', 'Dog', 'Cat'].getRandom(); // returns one of the items
-Array method: include {#Array:include}
---------------------------------
+Array method: link {#Array:link}
+--------------------------
-Pushes the passed element into the array if it's not already present (case and type sensitive).
+Accepts an object of key / function pairs to assign values.
### Syntax:
- myArray.include(item);
+ var result = myArray.link(object);
### Arguments:
-1. item - (*object*) The item that should be added to this array.
+1. object - (*object*) An object containing key / function pairs must be passed to be used as a template for associating values with the different keys.
### Returns:
-* (*array*) This array with the new item included.
+* (*object*) The new associated object.
### Examples:
- ['Cow', 'Pig', 'Dog'].include('Cat'); // returns ['Cow', 'Pig', 'Dog', 'Cat']
- ['Cow', 'Pig', 'Dog'].include('Dog'); // returns ['Cow', 'Pig', 'Dog']
-
-### Notes:
-
-If you want to push the passed element even if it's already present, use
-the vanilla javascript:
-
- myArray.push(item);
-
-Array method: combine {#Array:combine}
---------------------------------
-
-Combines an array with all the items of another. Does not allow duplicates and is case and type sensitive.
-
-### Syntax:
-
- myArray.combine(array);
-
-### Arguments:
-
-1. array - (*array*) The array whose items should be combined into this array.
-
-### Returns:
-
-* (*array*) This array combined with the new items.
-
-### Examples:
+ var el = document.createElement('div');
+ var arr2 = [100, 'Hello', {foo: 'bar'}, el, false];
+ arr2.link({
+ myNumber: Type.isNumber,
+ myElement: Type.isElement,
+ myObject: Type.isObject,
+ myString: Type.isString,
+ myBoolean: function(obj){ return obj != null; }
+ });
+ // returns {myNumber: 100, myElement: el, myObject: {foo: 'bar'}, myString: 'Hello', myBoolean: false}
- var animals = ['Cow', 'Pig', 'Dog'];
- animals.combine(['Cat', 'Dog']); //animals = ['Cow', 'Pig', 'Dog', 'Cat'];
-Array method: erase {#Array:erase}
-----------------------------
+Array method: map {#Array:map}
+------------------------
-Removes all occurrences of an item from the array.
+Creates a new array with the results of calling a provided function on every element in the array.
+This method is provided only for browsers without native [Array:map][] support.
### Syntax:
- myArray.erase(item);
+ var mappedArray = myArray.map(fn[, bind]);
### Arguments:
-1. item - (*object*) The item to search for in the array.
-
-### Returns:
-
-* (*array*) This array with all occurrences of the item removed.
-
-### Examples:
-
- ['Cow', 'Pig', 'Dog', 'Cat', 'Dog'].erase('Dog') // returns ['Cow', 'Pig', 'Cat']
- ['Cow', 'Pig', 'Dog'].erase('Cat') // returns ['Cow', 'Pig', 'Dog']
-
+1. fn - (*function*) The function to produce an element of the new Array from an element of the current one.
+2. bind - (*object*, optional) The object to use as 'this' in the function. For more information see [Function:bind][].
+#### Argument: fn
-Array method: empty {#Array:empty}
-----------------------------
+##### Syntax:
-Empties an array.
+ fn(item, index, array)
-### Syntax:
+##### Arguments:
- myArray.empty();
+1. item - (*mixed*) The current item in the array.
+2. index - (*number*) The current item's index in the array.
+3. array - (*array*) The actual array.
### Returns:
-* (*array*) This array, emptied.
+* (*array*) The new mapped array.
### Examples:
- var myArray = ['old', 'data'];
- myArray.empty(); //myArray is now []
-
-
-Array method: flatten {#Array:flatten}
---------------------------------
-
-Flattens a multidimensional array into a single array.
-
-### Syntax:
-
- myArray.flatten();
-
-### Returns:
-
-* (*array*) A new flat array.
+ var timesTwo = [1, 2, 3].map(function(item, index){
+ return item * 2;
+ }); //timesTwo = [2, 4, 6];
-### Examples:
+### See Also:
- var myArray = [1,2,3,[4,5, [6,7]], [[[8]]]];
- var newArray = myArray.flatten(); //newArray is [1,2,3,4,5,6,7,8]
+- [MDC Array:map][]
@@ -719,64 +714,79 @@ This is equivalent to *$pick* from MooTools 1.2.
-Array method: hexToRgb {#Array:hexToRgb}
+Array method: rgbToHex {#Array:rgbToHex}
----------------------------------
-Converts an hexadecimal color value to RGB. Input array must be the following hexadecimal color format.
-\['FF', 'FF', 'FF'\]
+Converts an RGB color value to hexadecimal. Input array must be in one of the following RGB color formats.
+\[255, 255, 255\], or \[255, 255, 255, 1\]
### Syntax:
- myArray.hexToRgb([array]);
+ myArray.rgbToHex([array]);
### Arguments:
-1. array - (*boolean*, optional) If true is passed, will output an array (e.g. \[255, 51, 0\]) instead of a string (e.g. "rgb(255, 51, 0)").
+1. array - (*boolean*, optional) If true is passed, will output an array (e.g. \['ff', '33', '00'\]) instead of a string (e.g. '#ff3300').
### Returns:
-* (*string*) A string representing the color in RGB.
+* (*string*) A string representing the color in hexadecimal, or 'transparent' string if the fourth value of rgba in the input array is 0 (rgba).
* (*array*) If the array flag is set, an array will be returned instead.
### Examples:
- ['11', '22', '33'].hexToRgb(); // returns 'rgb(17, 34, 51)'
- ['11', '22', '33'].hexToRgb(true); // returns [17, 34, 51]
+ [17, 34, 51].rgbToHex(); // returns '#112233'
+ [17, 34, 51].rgbToHex(true); // returns ['11', '22', '33']
+ [17, 34, 51, 0].rgbToHex(); // returns 'transparent'
### See Also:
-- [String:hexToRgb][]
+- [String:rgbToHex][]
-Array method: rgbToHex {#Array:rgbToHex}
-----------------------------------
+Array method: some {#Array:some}
+--------------------------
-Converts an RGB color value to hexadecimal. Input array must be in one of the following RGB color formats.
-\[255, 255, 255\], or \[255, 255, 255, 1\]
+Returns true if at least one element in the array satisfies the provided testing function.
+This method is provided only for browsers without native [Array:some][] support.
### Syntax:
- myArray.rgbToHex([array]);
+ var somePassed = myArray.some(fn[, bind]);
+
+### Returns:
+
+* (*boolean*) If at least one element in the array satisfies the provided testing function returns true. Otherwise, returns false.
### Arguments:
-1. array - (*boolean*, optional) If true is passed, will output an array (e.g. \['ff', '33', '00'\]) instead of a string (e.g. '#ff3300').
+1. fn - (*function*) The function to test for each element. This function is passed the item and its index in the array.
+2. bind - (*object*, optional) The object to use as 'this' in the function. For more information see [Function:bind][].
-### Returns:
+#### Argument: fn
-* (*string*) A string representing the color in hexadecimal, or 'transparent' string if the fourth value of rgba in the input array is 0 (rgba).
-* (*array*) If the array flag is set, an array will be returned instead.
+##### Syntax:
+
+ fn(item, index, array)
+
+##### Arguments:
+
+1. item - (*mixed*) The current item in the array.
+2. index - (*number*) The current item's index in the array.
+3. array - (*array*) The actual array.
### Examples:
- [17, 34, 51].rgbToHex(); // returns '#112233'
- [17, 34, 51].rgbToHex(true); // returns ['11', '22', '33']
- [17, 34, 51, 0].rgbToHex(); // returns 'transparent'
+ var isAnyBigEnough = [10, 4, 25, 100].some(function(item, index){
+ return item > 20;
+ }); // isAnyBigEnough = true
### See Also:
-- [String:rgbToHex][]
+- [MDC Array:some][]
+
+
Something went wrong with that request. Please try again.