1
0
Fork 0
mirror of synced 2024-06-01 18:20:18 +12:00
budibase/packages/backend-core/src/helpers.js
2022-01-10 19:30:35 +00:00

10 lines
325 B
JavaScript

/**
* Makes sure that a URL has the correct number of slashes, while maintaining the
* http(s):// double slashes.
* @param {string} url The URL to test and remove any extra double slashes.
* @return {string} The updated url.
*/
exports.checkSlashesInUrl = url => {
return url.replace(/(https?:\/\/)|(\/)+/g, "$1$2")
}