docker-parse-image
Advanced tools
Comparing version 2.0.0 to 3.0.0
14
index.js
@@ -7,2 +7,4 @@ module.exports = function(image) { | ||
var namespace = match[2] | ||
var repository = match[3] | ||
var tag = match[4] | ||
@@ -17,10 +19,14 @@ if (!namespace && registry && !/[:.]/.test(registry)) { | ||
namespace: namespace || null, | ||
repository: match[3], | ||
tag: match[4] || null | ||
repository: repository, | ||
tag: tag || null | ||
} | ||
result.name = (registry ? registry+'/' : '') + (namespace ? namespace+'/' : '') + result.repository | ||
result.fullname = result.name+(result.tag ? ':'+result.tag : '') | ||
registry = registry ? registry+'/' : '' | ||
namespace = namespace ? namespace+'/' : '' | ||
tag = result.tag ? ':'+result.tag : '' | ||
result.name = registry + namespace + repository + tag | ||
result.fullname = registry + (namespace || 'library/') + repository + (tag || ':latest') | ||
return result | ||
} |
{ | ||
"name": "docker-parse-image", | ||
"version": "2.0.0", | ||
"version": "3.0.0", | ||
"description": "Parse docker image urls", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
32
test.js
@@ -11,3 +11,3 @@ var parse = require('./') | ||
name:'mafintosh/test', | ||
fullname:'mafintosh/test' | ||
fullname:'mafintosh/test:latest' | ||
}) | ||
@@ -21,3 +21,3 @@ | ||
name:'ubuntu', | ||
fullname:'ubuntu' | ||
fullname:'library/ubuntu:latest' | ||
}) | ||
@@ -30,3 +30,3 @@ | ||
tag:'14.04', | ||
name:'mafintosh/test', | ||
name:'mafintosh/test:14.04', | ||
fullname:'mafintosh/test:14.04' | ||
@@ -40,4 +40,4 @@ }) | ||
tag:'14.04', | ||
name:'ubuntu', | ||
fullname:'ubuntu:14.04' | ||
name:'ubuntu:14.04', | ||
fullname:'library/ubuntu:14.04' | ||
}) | ||
@@ -50,4 +50,4 @@ | ||
tag:'14.04', | ||
name:'registry.com/ubuntu', | ||
fullname:'registry.com/ubuntu:14.04' | ||
name:'registry.com/ubuntu:14.04', | ||
fullname:'registry.com/library/ubuntu:14.04' | ||
}) | ||
@@ -60,4 +60,4 @@ | ||
tag:'14.04', | ||
name:'registry.com/ubuntu', | ||
fullname:'registry.com/ubuntu:14.04' | ||
name:'registry.com/ubuntu:14.04', | ||
fullname:'registry.com/library/ubuntu:14.04' | ||
}) | ||
@@ -74,3 +74,3 @@ | ||
tag:'14.04', | ||
name:'mafintosh/test', | ||
name:'mafintosh/test:14.04', | ||
fullname:'mafintosh/test:14.04' | ||
@@ -84,4 +84,4 @@ }) | ||
tag:'14.04', | ||
name:'ubuntu', | ||
fullname:'ubuntu:14.04' | ||
name:'ubuntu:14.04', | ||
fullname:'library/ubuntu:14.04' | ||
}) | ||
@@ -94,4 +94,4 @@ | ||
tag:'14.04', | ||
name:'registry.com/ubuntu', | ||
fullname:'registry.com/ubuntu:14.04' | ||
name:'registry.com/ubuntu:14.04', | ||
fullname:'registry.com/library/ubuntu:14.04' | ||
}) | ||
@@ -104,4 +104,4 @@ | ||
tag:'14.04', | ||
name:'registry.com/ubuntu', | ||
fullname:'registry.com/ubuntu:14.04' | ||
name:'registry.com/ubuntu:14.04', | ||
fullname:'registry.com/library/ubuntu:14.04' | ||
}) | ||
@@ -108,0 +108,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
5563
111