c9-core/node_modules/c9/docker-helpers.js

22 wiersze
686 B
JavaScript
Czysty Zwykły widok Historia

2016-01-06 01:15:54 +00:00
var dockerHelpers = {
getUsernameFromContainerName: function (containerName) {
if (containerName.split("-").length < 3) return "";
return containerName.replace(/^container-/, "")
.replace(/-[a-zA-Z]+$/, "")
.replace(/-[0-9]+$/, "")
.split("-")[0];
},
getProjectNameFromContainerName: function (containerName) {
if (containerName.split("-").length < 3) return "";
return containerName.replace(/^container-/, "")
.replace(/-[a-zA-Z]+$/, "")
.replace(/-[0-9]+$/, "")
.split("-")
.splice(1)
.join("-");
}
}
module.exports = dockerHelpers;