Skip to content

Commit

Permalink
Fix npm search results parse. Fixes #8 and #9.
Browse files Browse the repository at this point in the history
  • Loading branch information
khornberg committed Sep 18, 2014
1 parent 6466f02 commit 1c309a2
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions modules/managers/npm.js
Original file line number Diff line number Diff line change
Expand Up @@ -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];
Expand Down

0 comments on commit 1c309a2

Please sign in to comment.