let - const

This commit is contained in:
WangXinhai 2018-04-01 14:35:33 +08:00 committed by GitHub
parent 0d21a7be8d
commit 2ea0f80a2d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 4 deletions
src/components/ThemePicker

View File

@ -66,11 +66,11 @@ export default {
methods: {
updateStyle(style, oldCluster, newCluster) {
let colorOverrides = [] // only capture color overides
const colorOverrides = [] // only capture color overides
oldCluster.forEach((color, index) => {
let value = newCluster[index]
let repl = new RegExp(`(^|})([^{]+{[^{}]+)${color}\\b([^}]*)(?=})`, 'gi')
let nestRepl = new RegExp(color, 'ig') // for greed matching before the 'color'
const value = newCluster[index]
const repl = new RegExp(`(^|})([^{]+{[^{}]+)${color}\\b([^}]*)(?=})`, 'gi')
const nestRepl = new RegExp(color, 'ig') // for greed matching before the 'color'
let v
while ((v = repl.exec(style))) {
colorOverrides.push(v[2].replace(nestRepl, value) + value + v[3] + '}') // '}' not captured in the regexp repl to reserve it as locator-boundary