@technobuddha/library
Version:
A large library of useful functions
16 lines (15 loc) • 460 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.ensurePrefix = void 0;
/**
* Add a prefix to a string, if it does not already have the prefix
*
* @param input The string
* @param prefix The prefix
* @returns The prefix followed by the string
*/
function ensurePrefix(input, prefix) {
return input.startsWith(prefix) ? input : prefix + input;
}
exports.ensurePrefix = ensurePrefix;
exports.default = ensurePrefix;