From 71c662c11fcf5179efbad94971261274768ee795 Mon Sep 17 00:00:00 2001
From: Rhys Arkins <rhys@arkins.net>
Date: Mon, 11 Jun 2018 07:32:38 +0200
Subject: [PATCH] fix: purl return empty qualifiers object

---
 lib/util/purl.js                          | 2 ++
 test/util/__snapshots__/purl.spec.js.snap | 3 +++
 2 files changed, 5 insertions(+)

diff --git a/lib/util/purl.js b/lib/util/purl.js
index 17d605e227..3cfb0caa88 100644
--- a/lib/util/purl.js
+++ b/lib/util/purl.js
@@ -41,6 +41,8 @@ function parse(input) {
       const [key, val] = qualifier.split('=');
       res.qualifiers[key] = val;
     });
+  } else {
+    res.qualifiers = {};
   }
   return res;
 }
diff --git a/test/util/__snapshots__/purl.spec.js.snap b/test/util/__snapshots__/purl.spec.js.snap
index 635d4923b0..2364379181 100644
--- a/test/util/__snapshots__/purl.spec.js.snap
+++ b/test/util/__snapshots__/purl.spec.js.snap
@@ -5,6 +5,7 @@ Object {
   "fullname": "@foo/bar",
   "name": "bar",
   "namespace": "@foo",
+  "qualifiers": Object {},
   "type": "npm",
 }
 `;
@@ -14,6 +15,7 @@ Object {
   "fullname": "@foo/bar",
   "name": "bar",
   "namespace": "@foo",
+  "qualifiers": Object {},
   "type": "npm",
   "version": "1.0.0",
 }
@@ -62,6 +64,7 @@ exports[`util/purl parse() parses simple npm 1`] = `
 Object {
   "fullname": "foo",
   "name": "foo",
+  "qualifiers": Object {},
   "type": "npm",
 }
 `;
-- 
GitLab