TinyMCE:API/tinymce/grep
From Moxiecode Documentation Wiki
< TinyMCE:API | tinymce
Contents |
[edit]
Method: grep
[edit]
Summary
Filters out items from the input array by calling the specified function for each item. If the function returns false the item will be excluded if it returns true it will be included.
[edit]
Syntax
<Array> grep(<Array> a, <function> f)
[edit]
Parameters
- a
- Array of items to loop though.
- f
- Function to call for each item. Include/exclude depends on it's return value.
[edit]
Returns
New array with values imported and filtered based in input.
[edit]
Examples
// Filter out some items, this will return an array with 4 and 5
var items = tinymce.grep([1,2,3,4,5], function(v) {return v > 3;});
