@sap-cloud-sdk/util
Version:
SAP Cloud SDK for JavaScript general utilities
29 lines • 865 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.removeSlashes = removeSlashes;
exports.removeTrailingSlashes = removeTrailingSlashes;
exports.removeLeadingSlashes = removeLeadingSlashes;
/**
* @internal
* Utility function to remove a single leading and trailing slash from a path.
*/
function removeSlashes(path) {
path = removeLeadingSlashes(path);
path = removeTrailingSlashes(path);
return path;
}
/**
* @internal
* Utility function to remove a single trailing slash from a path.
*/
function removeTrailingSlashes(path) {
return path.endsWith('/') ? path.slice(0, -1) : path;
}
/**
* @internal
* Utility function to remove a single leading slash from a path.
*/
function removeLeadingSlashes(path) {
return path.startsWith('/') ? path.slice(1) : path;
}
//# sourceMappingURL=remove-slashes.js.map