* Fix #2232 - wrongly matching prop after comments ending with a dot * Avoid matching urls `://`
This commit is contained in:
parent
385458aadd
commit
68e412bb59
3 changed files with 6 additions and 5 deletions
|
|
@ -93,9 +93,10 @@ function run(input, output) {
|
|||
})
|
||||
|
||||
//fix props
|
||||
var props = new RegExp("(\\.\\s*)(" + candidates + ")|([\\{,]\\s*)(" + candidates + ")(\\s*:)", "gm")
|
||||
var props = new RegExp("((?:[^:]\\/\\/.*)?\\.\\s*)(" + candidates + ")|([\\{,]\\s*)(" + candidates + ")(\\s*:)", "gm")
|
||||
code = code.replace(props, function(match, dot, a, pre, b, post) {
|
||||
if (dot) return dot + a.replace(/\d+$/, "")
|
||||
if (dot && dot.indexOf("//") === 1) return match // Don't do anything because dot was matched in a comment
|
||||
else if (dot) return dot + a.replace(/\d+$/, "")
|
||||
else return pre + b.replace(/\d+$/, "") + post
|
||||
})
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue