Skip to content

Commit

Permalink
Parse Sass version info without a regexp
Browse files Browse the repository at this point in the history
  • Loading branch information
nex3 committed Jun 2, 2018
1 parent cc9a3b5 commit e976db2
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions lib/loader.js
Expand Up @@ -103,14 +103,14 @@ function sassLoader(content) {
* @param {string} info
*/
function validateSassVersion(info) {
const parsed = /^([^\t]+)\t([^\t]+)/.exec(info);
const components = info.split("\t");

if (!parsed) {
if (components.length < 2) {
throw new Error("Unknown Sass implementation \"" + info + "\".");
}

const implementation = parsed[1];
const version = parsed[2];
const implementation = components[0];
const version = components[1];

if (!semver.valid(version)) {
throw new Error("Invalid Sass version \"" + version + "\".");
Expand Down

0 comments on commit e976db2

Please sign in to comment.