Skip to main content

Function: endsWith()

endsWith(suffix): Predicate<string>

Defined in: predicate/comparison/index.ts:227

Creates a predicate that tests if a string ends with a suffix.

Case-sensitive.

Parameters

suffix

string

The suffix to test for

Returns

Predicate<string>

A predicate that returns true if value ends with suffix

Example

import * as R from 'remeda'

const files = ['app.ts', 'app.js', 'config.json', 'test.spec.ts']
R.filter(files, endsWith('.ts')) // => ['app.ts', 'test.spec.ts']

See

  • startsWith - for prefix testing
  • includes - for substring testing