sworm
Version:
a lightweight write-only ORM for MSSQL, MySQL, PostgreSQL, Oracle, Sqlite 3
13 lines (10 loc) • 306 B
JavaScript
var urlUtils = require('url');
module.exports = function(url, replacement) {
var urlComponents = urlUtils.parse(url);
if (urlComponents.auth) {
urlComponents.auth = urlComponents.auth.replace(/:.*/, ':' + replacement);
return urlUtils.format(urlComponents);
} else {
return url;
}
};