Skip to content

Commit 5020eb5

Browse files
committed
Improve get url value
1 parent 4a27d08 commit 5020eb5

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

src/get-data/rules/url.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
'use strict'
22

33
const {isString} = require('lodash')
4-
const {getUrl} = require('../util')
4+
const {getUrl, isUrl} = require('../util')
55

66
/**
77
* Wrap a rule with validation and formatting logic.
@@ -12,8 +12,7 @@ const {getUrl} = require('../util')
1212

1313
const wrap = rule => (htmlDom, url) => {
1414
const value = rule(htmlDom)
15-
if (!isString(value)) return
16-
return getUrl(value)
15+
return isUrl(value) ? getUrl(value) : url
1716
}
1817

1918
/**

0 commit comments

Comments
 (0)