You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
consul/ui/packages/consul-ui/app/utils/right-trim.js

8 lines
210 B

export default function rightTrim(str = '', search = '') {
const pos = str.length - search.length;
if (pos >= 0) {
return str.lastIndexOf(search) === pos ? str.substr(0, pos) : str;
}
return str;
}