Lodash - noConflict method



Syntax

_.noConflict()

Reverts the _ variable to its previous value and returns a reference to the lodash function.

Output

  • (Function) − Returns the lodash function.

Example

var _ = require('lodash');
var lodash = _.noConflict();

function vowels(string) {
   return lodash.filter(string, function(v) {
      return /[aeiou]/i.test(v);
   });
}
console.log(vowels('Julie'));

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

Command

\>node tester.js

Output

[ 'u', 'i', 'e' ]
lodash_util.htm
Advertisements