From 97bb7891708cc85361bf700101495e5ecf64d1a7 Mon Sep 17 00:00:00 2001 From: Amos Wenger Date: Sun, 20 Mar 2016 23:34:21 +0100 Subject: [PATCH] Strip channel when calling semver.satisfies to allow custom channels --- lib/versions.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/versions.js b/lib/versions.js index 999cdc1f..d3ec800d 100644 --- a/lib/versions.js +++ b/lib/versions.js @@ -10,6 +10,10 @@ function normalizeTag(tag) { return tag; } +function stripChannel(tag) { + return tag.replace(/-.*$/, ''); +} + // Extract channel of version function extractChannel(tag) { var suffix = tag.split('-')[1]; @@ -106,7 +110,7 @@ Versions.prototype.filter = function(opts) { if (opts.platform && !platforms.satisfies(opts.platform, _.pluck(version.platforms, 'type'))) return false; // Check tag satisfies request version - return opts.tag == 'latest' || semver.satisfies(version.tag, opts.tag); + return opts.tag == 'latest' || semver.satisfies(stripChannel(version.tag), stripChannel(opts.tag)); }) .value(); });