how to use the endswith function from the lodash library in typescript

To use the endsWith function from the Lodash library in TypeScript, first, you need to install the Lodash library:

npm install lodash
19 chars
2 lines

Then, to use the endsWith function in your TypeScript code, you need to import it from the Lodash library like this:

index.ts
import { endsWith } from 'lodash';
35 chars
2 lines

After that, you can use the endsWith function in your TypeScript code like this:

index.ts
const str: string = 'Hello world';

console.log(endsWith(str, 'world')); // true
console.log(endsWith(str, 'World')); // false
127 chars
5 lines

That's it! Now you know how to use the endsWith function from the Lodash library in TypeScript.

gistlibby LogSnag