From 1c309a26d0eb913fc0dd761cac83fd08a4c3fee1 Mon Sep 17 00:00:00 2001 From: khornberg <kyle.hornberg@gmail.com> Date: Thu, 18 Sep 2014 08:46:25 -0500 Subject: [PATCH] Fix npm search results parse. Fixes #8 and #9. --- modules/managers/npm.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/managers/npm.js b/modules/managers/npm.js index a36d1ee..2f17982 100644 --- a/modules/managers/npm.js +++ b/modules/managers/npm.js @@ -146,8 +146,8 @@ define(function (require, exports, module) { details.forEach(function(line) { var name = line.match(/^[\w-]+/)[0], desc = line.match(/\s.*/)[0].split('=')[0].trim(), - authors = line.match(/=\w*/g).join(', ').replace(/=/g, ''), - date = line.match(/\d{4}-\d{2}-\d{2} \d{2}:\d{2}/)[0], + authors = (line.match(/=\w*/g)) ? line.match(/=\w*/g).join(', ').replace(/=/g, '') : '', + date = line.match(/\d{4}-\d{2}-\d{2} /)[0], version = (line.match(/\d*\.\d*\.\d*(-|\.|\w|\d)*/)) ? line.match(/\d*\.\d*\.\d*(-|\.|\w|\d)*/)[0] : '', keywords = (line.match(/\d*\.\d*\.\d*(-|\.|\w|\d)*$/)) ? '': line.split(/\d*\.\d*\.\d*(-|\.|\w|\d)*\s/).pop().trim(), //version last on the line? pkg = [name, desc, authors, date, version, keywords];