From 25ae6b44cec25bcf8401c615993ed106b2e6fa24 Mon Sep 17 00:00:00 2001 From: tjcrowder Date: Mon, 7 Sep 2009 16:25:51 +0100 Subject: [PATCH] doc: merged and updated old docs for Enumerable#pluck --- src/lang/enumerable.js | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/src/lang/enumerable.js b/src/lang/enumerable.js index 7d587af..7b87fca 100644 --- a/src/lang/enumerable.js +++ b/src/lang/enumerable.js @@ -599,10 +599,17 @@ var Enumerable = (function() { } /** - * Enumerable#pluck(propertyName) -> Array + * Enumerable#pluck(property) -> Array + * - property (String): The name of the property to fetch. * - * Optimization for a common use-case of collect: fetching the same property - * for all the elements. Returns the property values. + * Pre-baked implementation for a common use-case of [[Enumerable#collect]] + * and [[Enumerable#each]]: fetching the same property for all of the + * elements. Returns an array of the property values. + * + * ### Example + * + * ['hello', 'world', 'this', 'is', 'nice'].pluck('length') + * // -> [5, 5, 4, 2, 4] **/ function pluck(property) { var results = [];