Add maxWait option to _.debounce and implement _.throttle by way of _.debounce. [closes #285]

Former-commit-id: 63b41aac298e5fa89f7922e84b2ed0d5c6545bd3
This commit is contained in:
John-David Dalton
2013-06-10 11:16:14 -07:00
parent c20d7f9754
commit 1933a76631
4 changed files with 97 additions and 51 deletions

View File

@@ -167,7 +167,7 @@
'sortedIndex': ['createCallback', 'identity'],
'tap': ['value'],
'template': ['defaults', 'escape', 'escapeStringChar', 'keys', 'values'],
'throttle': ['isObject'],
'throttle': ['debounce'],
'times': ['createCallback'],
'toArray': ['isString', 'slice', 'values'],
'transform': ['createCallback', 'createObject', 'forOwn', 'isArray'],
@@ -3342,6 +3342,11 @@
// remove `templateSettings` assignment
source = source.replace(/(?:\n +\/\*[^*]*\*+(?:[^\/][^*]*\*+)*\/)?\n *lodash\.templateSettings[\s\S]+?};\n/, '');
}
if (isRemoved(source, 'throttle')) {
_.each(['leading', 'maxWait', 'trailing'], function(prop) {
source = removeFromGetObject(source, prop);
});
}
if (isRemoved(source, 'value')) {
source = removeFunction(source, 'chain');
source = removeFunction(source, 'wrapperToString');