@raulingg/md-links
Advanced tools
Comparing version 0.5.1 to 0.5.2
@@ -22,15 +22,10 @@ "use strict"; | ||
const stats = (markdownLinks, validate = false) => { | ||
const stats = { | ||
total: markdownLinks.length, | ||
unique: (0, _util.uniqueBy)(markdownLinks, 'href').length | ||
}; | ||
const stats = markdownLinks => ({ | ||
total: markdownLinks.length, | ||
unique: (0, _util.uniqueBy)(markdownLinks, 'href').length, | ||
...('status' in markdownLinks[0] && { | ||
broken: onlyBroken(markdownLinks).length | ||
}) | ||
}); | ||
if (validate) { | ||
stats.broken = onlyBroken(markdownLinks).length; | ||
} | ||
return stats; | ||
}; | ||
const pipe = (path, validate) => text => { | ||
@@ -79,3 +74,3 @@ const links = (0, _util.matchMarkdownLinks)(text); | ||
data: () => links, | ||
stats: () => stats(links, options.validate) | ||
stats: () => stats(links) | ||
})); | ||
@@ -82,0 +77,0 @@ } catch (err) { |
@@ -39,7 +39,3 @@ "use strict"; | ||
const findMarkdownFiles = path => { | ||
try { | ||
return _fs.default.statSync(path).isDirectory() ? _fs.default.readdirSync(path).reduce((ac, item) => ac.concat(findMarkdownFiles((0, _path.join)(path, item))), []) : isMarkdownFile(path) ? [path] : []; | ||
} catch (err) { | ||
throw new Error('path provided not found', err.message || err); | ||
} | ||
return _fs.default.statSync(path).isDirectory() ? _fs.default.readdirSync(path).reduce((ac, item) => ac.concat(findMarkdownFiles((0, _path.join)(path, item))), []) : isMarkdownFile(path) ? [path] : []; | ||
}; | ||
@@ -46,0 +42,0 @@ |
{ | ||
"name": "@raulingg/md-links", | ||
"version": "0.5.1", | ||
"version": "0.5.2", | ||
"description": "This library allows you to find links within markdown files", | ||
@@ -22,7 +22,6 @@ "author": "Raul Quispe <relaxedchild@gmail.com>", | ||
"scripts": { | ||
"clean": "rm -rf dist", | ||
"test": "jest", | ||
"test:coverage": "jest --coverage", | ||
"build": "babel src --out-dir dist", | ||
"prepublish": "npm run clean && npm run test && npm run build" | ||
"build": "rm -rf dist && babel src --out-dir dist", | ||
"prepublishOnly": "npm run test && npm run build" | ||
}, | ||
@@ -29,0 +28,0 @@ "devDependencies": { |
@@ -5,3 +5,3 @@ # Markdown Links | ||
[![Build Status](https://travis-ci.org/raulingg/md-links.svg?branch=master)](https://travis-ci.org/raulingg/md-links) | ||
[![Node.js CI](https://github.com/raulingg/md-links/actions/workflows/node.js.yml/badge.svg)](https://github.com/raulingg/md-links/actions/workflows/node.js.yml) | ||
[![Coverage Status](https://coveralls.io/repos/github/raulingg/md-links/badge.svg?branch=master)](https://coveralls.io/github/raulingg/md-links?branch=master) | ||
@@ -15,6 +15,4 @@ | ||
`npm install -g @raulingg/md-links` | ||
to install as a dependency in your project | ||
@@ -24,3 +22,2 @@ | ||
## Usage | ||
@@ -140,2 +137,3 @@ | ||
Find image and video url | ||
```md | ||
@@ -145,2 +143,3 @@ [![Solution Temperature converter](https://i.ytimg.com/vi/Ix6VLiBcABw/0.jpg)](https://www.youtube.com/watch?v=Ix6VLiBcABw) | ||
``` | ||
- Unsupported Cases | ||
@@ -147,0 +146,0 @@ |
12409
208
148