UNPKG

236 BJavaScriptView Raw
1/**
2 * Remove a prefix from a string. Return the input string if the given prefix
3 * isn't found.
4 */
5
6export default (str, prefix = ``) => {
7 if (str.substr(0, prefix.length) === prefix) return str.slice(prefix.length)
8 return str
9}