read-package-json
Advanced tools
Comparing version 0.0.8 to 0.0.9
{ | ||
"name": "read-package-json", | ||
"version": "0.0.8", | ||
"version": "0.0.9", | ||
"author": "Isaac Z. Schlueter <i@izs.me> (http://blog.izs.me/)", | ||
@@ -5,0 +5,0 @@ "description": "The thing npm uses to read package.json files with semantics and defaults and validation", |
@@ -212,12 +212,9 @@ // vim: set softtabstop=16 shiftwidth=16: | ||
var d = data.readme | ||
if (!d) return | ||
d = d.split('\n') | ||
d = d.filter(function (line) { | ||
return /\s+/.test(line) | ||
&& line.trim() !== data.name | ||
&& !line.trim().match(/^#/) | ||
})[0] | ||
d = d.trim() | ||
d = d.replace(/\.$/, '') | ||
if (d) data.description = d | ||
if (!d) return; | ||
// the first block of text before the first heading | ||
// that isn't the first line heading | ||
d = d.trim().split('\n') | ||
for (var s = 0; d[s].trim().match(/^(#|$)/); s ++); | ||
for (var e = s + 1; d[e].trim(); e ++); | ||
data.description = d.slice(s, e).join(' ').trim() | ||
} | ||
@@ -224,0 +221,0 @@ |
27361
523