Skip to content

Commit 0987003

Browse files
committed
feat: add strict option
1 parent 5d21241 commit 0987003

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

lib/index.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,9 @@ const qs = require('query-string')
22
const isUrl = require('is-url-superb')
33
const matchHelper = require('posthtml-match-helper')
44

5-
module.exports = config => tree => {
5+
module.exports = (config = {}) => tree => {
6+
config.strict = config.strict ?? true
7+
68
const process = node => {
79
if (!config || !config.parameters) {
810
return node
@@ -14,7 +16,7 @@ module.exports = config => tree => {
1416
const url = node.attrs.href
1517
const parsed = qs.parseUrl(url, config.qs)
1618

17-
if (isUrl(parsed.url.trim()) === false) {
19+
if (config.strict && !isUrl(parsed.url.trim())) {
1820
return node
1921
}
2022

0 commit comments

Comments
 (0)