github.com/outbrain/consul@v1.4.5/ui-v2/app/utils/right-trim.js (about) 1 export default function rightTrim(str = '', search = '') { 2 const pos = str.length - search.length; 3 return str.lastIndexOf(search) === pos ? str.substr(0, pos) : str; 4 }