Lodash - functions method


Advertisements

Syntax

_.functions(object)

Creates an array of function property names from own enumerable properties of object.

Arguments

  • object (Object) − The object to inspect.

Output

  • (Array) − Returns the function names.

Example

var _ = require('lodash');
 
function Foo() {
   this.a = _.constant('a');
   this.b = _.constant('b');
}
Foo.prototype.c = _.constant('c'); 
console.log(_.functions(new Foo));

Save the above program in tester.js. Run the following command to execute this program.

Command

\>node tester.js

Output

[ 'a', 'b' ]
lodash_object.htm
Advertisements