Skip to content

Commit 0ea6287

Browse files
committed
refactor: format code
1 parent dbcb600 commit 0ea6287

1 file changed

Lines changed: 8 additions & 8 deletions

File tree

src/update.js

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,15 @@ function setToSQL(sets) {
1212
const clauses = []
1313
for (const set of sets) {
1414
const { table, column, value, keyword } = set
15-
let str = [table, column].filter(hasVal).map(info => identifierToSql(info)).join('.')
16-
let prefix = ''
17-
let suffix = ''
18-
if (keyword) {
19-
prefix = `${toUpper(keyword)}(`
20-
suffix = ')'
15+
const str = [table, column].filter(hasVal).map(info => identifierToSql(info)).join('.')
16+
const setItem = [str]
17+
let val = ''
18+
if (value) {
19+
val = exprToSQL(value)
20+
setItem.push('=', val)
2121
}
22-
if (value) str = `${str} = ${prefix}${exprToSQL(value)}${suffix}`
23-
clauses.push(str)
22+
if (keyword) setItem[2] = `${toUpper(keyword)}(${val})`
23+
clauses.push(setItem.filter(hasVal).join(' '))
2424
}
2525
return clauses.join(', ')
2626
}

0 commit comments

Comments
 (0)