Issue #243. _.functions now also returns the names of function defined in the prototype chain.

This commit is contained in:
Jeremy Ashkenas
2011-07-13 11:09:51 -04:00
parent 727db393d5
commit cd236d4c47
2 changed files with 9 additions and 1 deletions

View File

@@ -22,6 +22,10 @@ $(document).ready(function() {
test("objects: functions", function() {
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');
var Animal = function(){};
Animal.prototype.run = function(){};
equals(_.functions(new Animal).join(''), 'run', 'also looks up functions on the prototype');
});
test("objects: extend", function() {