Lodash - functionsIn 方法
语法
_.functionsIn(object)
根据 object 自身和继承的可枚举属性创建一个函数属性名称数组。
参数
object (Object) − 要检查的对象。
输出
(Array) − 返回函数名称。
示例
var _ = require('lodash');
function Foo() {
this.a = _.constant('a');
this.b = _.constant('b');
}
Foo.prototype.c = _.constant('c');
console.log(_.functionsIn(new Foo));
将上述程序保存在 tester.js 中。运行以下命令执行该程序。
命令
\>node tester.js
输出
[ 'a', 'b', 'c' ]