The pick function from lodash is used to create an object composed of the picked object properties.
Syntax:
index.tsx24 chars2 lines
where:
object(Object): The source object.[paths](...(string|string[])): The property paths to pick.Example:
index.tsx263 chars16 linesIn the above example, pick function is used to create a new object with the name and age properties from the sourceObject. The resulting object is { "name": "John", "age": 30 }.
Note: In the example, require('lodash') is used to import the lodash library.
gistlibby LogSnag