The _.lookupGetter
method from lodash is used to retrieve the getter function of a given property from a given object. Here is an example of how to use it:
index.tsx275 chars14 lines
In the example above, we define an object person
which has a getter function fullName
. We use _.lookupGetter
to retrieve the getter function of the fullName
property and assign it to getterFunction
. Finally, we invoke getterFunction
to get the expected output.
Note that if the given property does not have a getter function, _.lookupGetter
returns undefined
.
gistlibby LogSnag