open-consul/ui-v2/app/helpers/right-trim.js

9 lines
254 B
JavaScript

import { helper } from '@ember/component/helper';
export function rightTrim([str = '', search = ''], hash) {
const pos = str.length - search.length;
return str.indexOf(search) === pos ? str.substr(0, pos) : str;
}
export default helper(rightTrim);