index.js
function endsWith(target, searchString, position) {
  position = position || target.length;
  position = position - searchString.length;
  let lastIndex = target.lastIndexOf(searchString);
  return lastIndex !== -1 && lastIndex === position;
}
function endsWith(target, searchString, position) {
  position = position || target.length;
  position = position - searchString.length;
  let lastIndex = target.lastIndexOf(searchString);
  return lastIndex !== -1 && lastIndex === position;
}
function endsWith ( target , searchString , position ) { position = position || target . length ; position = position - searchString . length ; let lastIndex = target . lastIndexOf ( searchString ) ; return lastIndex !== - 1 && lastIndex === position ; }
Adapted from String.prototype.endsWith polyfill.
Adapted from String . prototype . endsWith polyfill .