Update docs and dist.

This commit is contained in:
John-David Dalton
2013-09-08 00:28:54 -05:00
parent 2f1d8cc196
commit 692521c49d
8 changed files with 240 additions and 171 deletions

38
dist/lodash.js vendored
View File

@@ -5069,37 +5069,36 @@
*/
function debounce(func, wait, options) {
var args,
maxTimeoutId,
result,
stamp,
thisArg,
callCount = 0,
timeoutId,
trailingCall,
lastCalled = 0,
maxWait = false,
maxTimeoutId = null,
timeoutId = null,
trailing = true;
if (!isFunction(func)) {
throw new TypeError;
}
wait = nativeMax(0, wait || 0);
wait = nativeMax(0, wait) || 0;
if (options === true) {
var leading = true;
trailing = false;
} else if (isObject(options)) {
leading = options.leading;
maxWait = 'maxWait' in options && nativeMax(wait, options.maxWait || 0);
maxWait = 'maxWait' in options && (nativeMax(wait, options.maxWait) || 0);
trailing = 'trailing' in options ? options.trailing : trailing;
}
var delayed = function() {
var remaining = wait - (now() - stamp);
if (remaining <= 0) {
var isCalled = trailing && (!leading || callCount > 1);
if (maxTimeoutId) {
clearTimeout(maxTimeoutId);
}
callCount = 0;
maxTimeoutId = timeoutId = null;
var isCalled = trailingCall;
maxTimeoutId = timeoutId = trailingCall = undefined;
if (isCalled) {
lastCalled = now();
result = func.apply(thisArg, args);
@@ -5113,8 +5112,7 @@
if (timeoutId) {
clearTimeout(timeoutId);
}
callCount = 0;
maxTimeoutId = timeoutId = null;
maxTimeoutId = timeoutId = trailingCall = undefined;
if (trailing || (maxWait !== wait)) {
lastCalled = now();
result = func.apply(thisArg, args);
@@ -5125,12 +5123,10 @@
args = arguments;
stamp = now();
thisArg = this;
callCount++;
trailingCall = trailing && (timeoutId || !leading);
if (maxWait === false) {
if (leading && callCount < 2) {
result = func.apply(thisArg, args);
}
var leadingCall = leading && !timeoutId;
} else {
if (!maxTimeoutId && !leading) {
lastCalled = stamp;
@@ -5138,8 +5134,7 @@
var remaining = maxWait - (stamp - lastCalled);
if (remaining <= 0) {
if (maxTimeoutId) {
clearTimeout(maxTimeoutId);
maxTimeoutId = null;
maxTimeoutId = clearTimeout(maxTimeoutId);
}
lastCalled = stamp;
result = func.apply(thisArg, args);
@@ -5151,6 +5146,9 @@
if (!timeoutId && wait !== maxWait) {
timeoutId = setTimeout(delayed, wait);
}
if (leadingCall) {
result = func.apply(thisArg, args);
}
return result;
};
}
@@ -5682,8 +5680,8 @@
* // => 'hello curly'
*
* // using the internal `print` function in "evaluate" delimiters
* _.template('<% print("hello " + epithet); %>!', { 'epithet': 'stooge' });
* // => 'hello stooge!'
* _.template('<% print("hello " + name); %>!', { 'name': 'larry' });
* // => 'hello larry!'
*
* // using a custom template delimiters
* _.templateSettings = {
@@ -5800,9 +5798,7 @@
source +
'return __p\n}';
// Use a sourceURL for easier debugging and wrap in a multi-line comment to
// avoid issues with Narwhal, IE conditional compilation, and the JS engine
// embedded in Adobe products.
// Use a sourceURL for easier debugging.
// http://www.html5rocks.com/en/tutorials/developertools/sourcemaps/#toc-sourceurl
var sourceURL = '\n/*\n//# sourceURL=' + (options.sourceURL || '/lodash/template/source[' + (templateCounter++) + ']') + '\n*/';