endsWith source npm

_.endsWith([string=''], [target], [position=string.length])

Checks if string ends with the given target string.

Arguments

  1. [string=''] (string)

    The string to search.

  2. [target] (string)

    The string to search for.

  3. [position=string.length] (number)

    The position to search from.

Returns (boolean)

Returns true if string ends with target, else false.

Example

_.endsWith('abc', 'c');
// => true

_.endsWith('abc', 'b');
// => false

_.endsWith('abc', 'b', 2);
// => true