Initial draft of _.throttle and _.debounce

This commit is contained in:
Jeremy Ashkenas
2010-11-30 11:41:48 -05:00
parent 6763b06192
commit 9e3e067f50
3 changed files with 54 additions and 11 deletions

View File

@@ -11,15 +11,6 @@ $(document).ready(function() {
});
test("objects: functions", function() {
var expected = ["all", "any", "bind", "bindAll", "breakLoop", "clone", "compact",
"compose", "contains", "defer", "delay", "detect", "each", "every", "extend", "filter", "find", "first",
"flatten", "foldl", "foldr", "forEach", "functions", "head", "identity", "include",
"indexOf", "inject", "intersect", "invoke", "isArguments", "isArray", "isBoolean", "isDate", "isElement", "isEmpty", "isEqual",
"isFunction", "isNaN", "isNull", "isNumber", "isRegExp", "isString", "isUndefined", "keys", "last", "lastIndexOf", "map", "max",
"memoize", "methods", "min", "mixin", "noConflict", "pluck", "range", "reduce", "reduceRight", "reject", "rest", "select",
"size", "some", "sortBy", "sortedIndex", "tail", "tap", "template", "times", "toArray", "uniq", "unique",
"uniqueId", "values", "without", "wrap", "zip"];
same(expected, _.methods(_), 'provides a sorted list of functions');
var obj = {a : 'dash', b : _.map, c : (/yo/), d : _.reduce};
ok(_.isEqual(['b', 'd'], _.functions(obj)), 'can grab the function names of any passed-in object');
});