Files
30-seconds-of-code/node_modules/gatsby/cache-dir/strip-prefix.js
2019-08-20 15:52:05 +02:00

10 lines
236 B
JavaScript

/**
* Remove a prefix from a string. Return the input string if the given prefix
* isn't found.
*/
export default (str, prefix = ``) => {
if (str.substr(0, prefix.length) === prefix) return str.slice(prefix.length)
return str
}