From 4ab2bd4ee43d5b8ea4f09122a140cf51dd491d06 Mon Sep 17 00:00:00 2001 From: Nick Martin Date: Fri, 19 Sep 2014 15:27:57 -0700 Subject: [PATCH] Noop regex tweak and comments. --- tools/package-version-parser.js | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/tools/package-version-parser.js b/tools/package-version-parser.js index 00ae68451f..06c5f63793 100644 --- a/tools/package-version-parser.js +++ b/tools/package-version-parser.js @@ -272,13 +272,18 @@ PV.constraintToFullString = function (parsedConstraint) { return parsedConstraint.name + "@" + parsedConstraint.constraintString; }; -// Return true if the version was invalid prior to the 0.9.3. + +// Return true if the version constraint was invalid prior to 0.9.3 +// (adding ~ and || support) +// +// NOTE: this is not used on the client yet. This package is used by the +// package server to determine what is valid. PV.invalidFirstFormatConstraint = function (validConstraint) { if (!validConstraint) return false; // We can check this easily right now, because we introduced some new // characters. Anything with those characters is invalid prior to // 0.9.3. XXX: If we ever have to go through these, we should write a more // complicated regex. - return (/.*~.*/.test(validConstraint) || - /.*\|.*/.test(validConstraint)); -} + return (/~/.test(validConstraint) || + /\|/.test(validConstraint)); +};