You can use the _.isMatch
function from the Underscore library in TypeScript by installing the Underscore typings package and importing the function from the Underscore module.
Here's an example of how to do that:
index.ts41 chars2 lines
index.ts452 chars13 lines
In the above example, we installed the Underscore typings package and imported the isMatch
function from the Underscore module. We then defined an object and a pattern to test against the object. Finally, we tested whether the object matched the pattern using the isMatch
function and printed the result to the console. The output will be true
indicating that the pattern has matched the object.
gistlibby LogSnag