doesEndWith()
doesEndWith(
suffix
): (input
) =>boolean
Creates a predicate function that determines if a string ends with a specific suffix.
Parameters
suffix
string
The substring to use as the suffix
Returns
(
input
):boolean
Parameters
input
string
Returns
boolean
Remarks
- Pure function with no side effects
- Case-sensitive comparison
- Uses String.prototype.endsWith() internally
- Useful for array filtering and functional programming
Example
const isJsFile = doesEndWith('.js');
isJsFile('app.js'); // true
isJsFile('style.css'); // false