Returns a sorted list of the names of every method in an object — that is to say, the name of every function property of the object.

返回对象所包含的方法的列表,按A-Z排序.别名methods

_.functions(_);
=> ["all", "any", "bind", "bindAll", "clone", "compact", "compose" ...

源码:

 _.functions = _.methods = function(obj) {
    var names = [];
    for (var key in obj) {
      if (_.isFunction(obj[key])) names.push(key);
    }
    return names.sort();
  };

 

 

 


 

posted on 2012-04-16 21:38  himanhimao  阅读(168)  评论(0编辑  收藏  举报