UNPKG

@ryusei/code

Version:

<div align="center"> <a href="https://code.ryuseijs.com"> <img alt="RyuseiCode" src="https://code.ryuseijs.com/images/svg/logo.svg" width="70"> </a>

12 lines (11 loc) 356 B
/** * Checks if the string ends with the `search` string or not. * * @param string - A string to check. * @param search - A string to search. * * @return `true` if the string ends with the `search`, or otherwise `false`. */ export function endsWith( string: string, search: string ): boolean { return string.slice( - search.length ) === search; }