function endsWith (text, search) {
  const start = text.length - search.length
  const end = text.length
  return (text.substring(start, end) === search)
}
Check if a text ends with a certain string.
@param {string} text
@param {string} search