Open In App

Lodash _.entriesIn() Method

Improve
Improve
Like Article
Like
Save
Share
Report

The _.entriesIn() method is used to create an array of own and inherited enumerable string keyed-value pairs for the specified object. If object is a map or set, its entries are returned.

Syntax:

_.entriesIn(object)

Parameters: This method accepts a parameter as mentioned above and described below:

  • object: This parameter holds the object to query.

Return Value: This method returns the key-value pairs.

Example 1:

Javascript




// Defining Lodash variable
const _ = require('lodash');
  
// Initializing a function gfg
function gfg() {
  this.a = 5;
  this.b = 10;
  this.c = 15;
}
gfg.prototype.d = 20;
  
// Calling the _.entriesIn() function
_.entriesIn(new gfg);


Output:

[ [ 'a', 5 ], [ 'b', 10 ], [ 'c', 15 ], [ 'd', 20 ] ]

Example 2: In the below code, a set is used as the object, hence the _.entriesIn() function returns its entries.

Javascript




// Defining Lodash variable
const _ = require('lodash');
  
// Initializing a set
const object = {a: {b: 5}};
  
// Calling the _.entriesIn() function
_.entriesIn(object);


Output:

[ [ 'a', { b: 5 } ] ]

Note: This will not work in normal JavaScript because it requires the lodash library to be installed.


Last Updated : 18 Sep, 2020
Like Article
Save Article
Previous
Next
Share your thoughts in the comments
Similar Reads