Cleanup docs for _.omit, _.every, and _.template.

Former-commit-id: a2810a5db94ef1de4bb530a56b0f9f121688de05
This commit is contained in:
John-David Dalton
2013-02-01 01:31:08 -08:00
parent b296e1b340
commit f2dc490d6f
5 changed files with 240 additions and 183 deletions

View File

@@ -455,6 +455,7 @@
var data = {
// support properties
'hasDontEnumBug': hasDontEnumBug,
'hasEnumPrototype': hasEnumPrototype,
'nonEnumArgs': nonEnumArgs,
'noCharByIndex': noCharByIndex,
'shadowed': shadowed,
@@ -517,7 +518,7 @@
if (hasOwnProperty.call(iterable, index)) {
if (callback(iterable[index], index, collection) === indicatorObject) return result;
}
}
}
}
};
@@ -669,7 +670,7 @@
for (index in iterable) {
if (callback(iterable[index], index, collection) === indicatorObject) return result;
}
}
return result
};
@@ -703,7 +704,7 @@
if (hasOwnProperty.call(iterable, index)) {
if (callback(iterable[index], index, collection) === indicatorObject) return result;
}
}
}
return result
};
@@ -1446,11 +1447,11 @@
* @returns {Object} Returns an object without the omitted properties.
* @example
*
* _.omit({ 'name': 'moe', 'age': 40, 'userid': 'moe1' }, 'userid');
* // => { 'name': 'moe', 'age': 40 }
* _.omit({ 'name': 'moe', 'age': 40 }, 'age');
* // => { 'name': 'moe' }
*
* _.omit({ 'name': 'moe', '_hint': 'knucklehead', '_seed': '96c4eb' }, function(value, key) {
* return key.charAt(0) == '_';
* _.omit({ 'name': 'moe', 'age': 40 }, function(value) {
* return typeof value == 'number';
* });
* // => { 'name': 'moe' }
*/
@@ -1655,6 +1656,19 @@
*
* _.every([true, 1, null, 'yes'], Boolean);
* // => false
*
* var stooges = [
* { 'name': 'moe', 'age': 40 },
* { 'name': 'larry', 'age': 50 }
* ];
*
* // using callback "where" shorthand
* _.every(stooges, { 'age': 50 });
* // => false
*
* // using callback "pluck" shorthand
* _.every(stooges, 'age');
* // => true
*/
function every(collection, callback, thisArg) {
var result = true;
@@ -1749,7 +1763,7 @@
*
* // using callback "where" shorthand
* var veggie = _.find(food, { 'type': 'vegetable' });
* // => { 'name': 'beet', 'organic': false, 'type': 'vegetable' },
* // => { 'name': 'beet', 'organic': false, 'type': 'vegetable' }
*
* // using callback "pluck" shorthand
* var healthy = _.find(food, 'organic');
@@ -3558,12 +3572,17 @@
* A micro-templating method that handles arbitrary delimiters, preserves
* whitespace, and correctly escapes quotes within interpolated code.
*
* Note: In the development build `_.template` utilizes sourceURLs for easier
* Note: In the development build, `_.template` utilizes sourceURLs for easier
* debugging. See http://www.html5rocks.com/en/tutorials/developertools/sourcemaps/#toc-sourceurl
*
* Note: Lo-Dash may be used in Chrome extensions by either creating a `lodash csp`
* build and avoiding `_.template` use, or loading Lo-Dash in a sandboxed page.
* See http://developer.chrome.com/trunk/extensions/sandboxingEval.html
* build and using precompiled templates, or loading Lo-Dash in a sandbox.
*
* For more information on precompiling templates see:
* http://lodash.com/#custom-builds
*
* For more information on Chrome extension sandboxes see:
* http://developer.chrome.com/trunk/extensions/sandboxingEval.html
*
* @static
* @memberOf _