1.1.2 • Published 5 years ago

string-ends-with-x v1.1.2

Weekly downloads
5
License
MIT
Repository
github
Last release
5 years ago

string-ends-with-x

Determines whether a string ends with the characters of a specified string.

module.exportsboolean

This method determines whether a string begins with the characters of a specified string, returning true or false as appropriate.

Kind: Exported member
Returns: boolean - true if the given characters are found at the end of the string; otherwise, false.
Throws:

  • TypeError If string is null or undefined.
  • TypeError If searchString is a RegExp.
ParamTypeDescription
stringstringThe string to be search.
searchStringstringThe characters to be searched for at the end of this string.

Example

import endsWith from 'string-ends-with-x';

const str = 'To be, or not to be, that is the question.';

console.log(endsWith(str, 'question.')); // true
console.log(endsWith(str, 'to be'));     // false
console.log(endsWith(str, 'to be', 19)); // true