The entriesIn
function from lodash is used to retrieve all the enumerable properties of an object, including inherited ones. It returns an array of key-value pairs in the format of [key, value]
. Here's an example of how to use entriesIn
:
index.tsx251 chars12 lines
In the above example, we define a class MyClass
with two properties: myProp
on the instance and anotherProp
on the prototype. We then create an instance of the class and pass it to _.entriesIn
, which returns an array of key-value pairs for all the enumerable properties, including the inherited one.
Note that _.entriesIn
also works with plain objects and not just instances of classes.
gistlibby LogSnag