mirror of https://github.com/hashicorp/consul
5 lines
172 B
JavaScript
5 lines
172 B
JavaScript
|
export default function rightTrim(str = '', search = '') {
|
||
|
const pos = str.length - search.length;
|
||
|
return str.lastIndexOf(search) === pos ? str.substr(0, pos) : str;
|
||
|
}
|