The _.ismap
function in Lodash checks if a given value is a Map object.
To use the _.ismap
function, first, we need to install Lodash in our project using npm or yarn.
43 chars6 lines
Then we can import the _.ismap
function where we want to use it.
index.tsx361 chars12 lines
In the above code sample, we first import the _.ismap
function using require.
Then, we create a Map
object myMap
.
Finally, we call the isMap
function with myMap
as an argument and it returns true
since myMap
is an instance of Map
. We also call isMap
function with a non-Map object to check if it returns false
.
gistlibby LogSnag