"Fossies" - the Fresh Open Source Software Archive

Member "Atom/resources/app/apm/node_modules/normalize-package-data/lib/extract_description.js" (7 Feb 2017, 509 Bytes) of archive /windows/misc/atom-windows.zip:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) Javascript source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file.

    1 module.exports = extractDescription
    2 
    3 // Extracts description from contents of a readme file in markdown format
    4 function extractDescription (d) {
    5   if (!d) return;
    6   if (d === "ERROR: No README data found!") return;
    7   // the first block of text before the first heading
    8   // that isn't the first line heading
    9   d = d.trim().split('\n')
   10   for (var s = 0; d[s] && d[s].trim().match(/^(#|$)/); s ++);
   11   var l = d.length
   12   for (var e = s + 1; e < l && d[e].trim(); e ++);
   13   return d.slice(s, e).join(' ').trim()
   14 }