From 45d7e79f4b5daa35b53eb10e3cd3355bddd4c765 Mon Sep 17 00:00:00 2001 From: tjcrowder Date: Mon, 7 Sep 2009 14:33:18 +0100 Subject: [PATCH] doc: update docs for Enumerable#each. --- src/lang/enumerable.js | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/lang/enumerable.js b/src/lang/enumerable.js index 3f6a6b9..db4a09e 100644 --- a/src/lang/enumerable.js +++ b/src/lang/enumerable.js @@ -92,6 +92,19 @@ var Enumerable = (function() { * the keyword `this` means inside `iterator`. * * Calls `iterator` for each item in the collection. + * + * ### Examples + * + * ['one', 'two', 'three'].each(alert); + * // Alerts "one", then alerts "two", then alerts "three" + * + * ### Built-In Variants + * + * Most of the common use cases for `each` are already available pre-coded + * as other methods on `Enumerable`. Whether you want to find the first + * matching item in an enumeration, or transform it, or determine whether it + * has any (or all) values matching a particular condition, `Enumerable` + * has a method to do that for you. **/ function each(iterator, context) { var index = 0;