Open In App

Lodash _.noConflict() Method

Lodash _.noConflict() method of Util is used to revert the variable to its former value and return a reference to the lodash function.

Syntax:

_.noConflict();

Parameters:

This method doesn’t accept any parameter.



Return Value:

This method returns the lodash function.

Example: In this example, we are getting the reference of lodash function and printing it into the console.






// Requiring lodash library
const _ = require('lodash');
 
// Calling _.noConflict() method
let lod = _.noConflict();
 
// Displays output
console.log(lod);

Output:

[Function: lodash] {
templateSettings: {
escape: /<%-([\s\S]+?)%>/g,
evaluate: /<%([\s\S]+?)%>/g,
interpolate: /<%=([\s\S]+?)%>/g,
variable: '',
imports: { _: [Circular] }
},
..........
upperCase: [Function (anonymous)],
upperFirst: [Function (anonymous)],
each: [Function: forEach],
eachRight: [Function: forEachRight],
first: [Function: head],
VERSION: '4.17.21',
_: [Circular *1]
}
Article Tags :