UNPKG

@feugene/mu

Version:

Helpful TS utilities without dependencies

15 lines 380 B
import endsWith from './endsWith.mjs'; /** * Remove a suffix from a String * * @param {string} str * @param {string} suffix * @returns {string} */ export default function trimSuffix(str, suffix) { if (!str || !suffix || !endsWith(str, suffix)) { return str; } return str.substring(0, str.length - suffix.length); } //# sourceMappingURL=trimSuffix.mjs.map