Comparing version 51.2.3 to 51.3.0
@@ -231,9 +231,41 @@ /* eslint-disable max-lines-per-function */ | ||
} | ||
const fnKeys = [ | ||
'CASE', | ||
'WHEN', | ||
'THEN', | ||
'ELSE', | ||
'ELS', | ||
'END', | ||
]; | ||
function defaultGlobalWrapIdentifier(value, origImpl) { | ||
const ret = origImpl(value); | ||
if (value === '' && ret === '``') { | ||
const dem2 = '\''; | ||
// original IFNULL(user.distotal, 0) as foo | ||
// from: IFNULL(user => input: `IFNULL(user` fix to 'IFNULL(user | ||
// from: distotal, 0) => input: `distotal, 0)` fix to distotal, 0)' | ||
if (value.includes('(')) { | ||
const line = dem2 + value; | ||
return line; | ||
} | ||
if (value.includes(')')) { | ||
const line = value + dem2; | ||
return line; | ||
} | ||
const upper = value.toUpperCase().trim(); | ||
const matched = fnKeys.find(key => upper.includes(key)); | ||
if (matched) { | ||
if (upper.startsWith('CASE ')) { | ||
const line = dem2 + value; | ||
return line; | ||
} | ||
if (upper.endsWith(' END')) { | ||
const line = value + dem2; | ||
return line; | ||
} | ||
} | ||
const line = origImpl(value); | ||
if (value === '' && line === '``') { | ||
return '\'\''; | ||
} | ||
return ret; | ||
return line; | ||
} | ||
//# sourceMappingURL=kmore.js.map |
{ | ||
"name": "kmore", | ||
"author": "waiting", | ||
"version": "51.2.3", | ||
"version": "51.3.0", | ||
"description": "A SQL query builder based on knex with powerful TypeScript type support", | ||
@@ -81,3 +81,3 @@ "keywords": [ | ||
}, | ||
"gitHead": "6987fbe9ca5825c8ea6601952850302412b41a11" | ||
"gitHead": "1a104dd685dedb80b937174699b94b5bc14e2282" | ||
} |
@@ -326,9 +326,47 @@ /* eslint-disable max-lines-per-function */ | ||
const fnKeys = [ | ||
'CASE', | ||
'WHEN', | ||
'THEN', | ||
'ELSE', | ||
'ELS', | ||
'END', | ||
] | ||
function defaultGlobalWrapIdentifier(value: string, origImpl: (input: string) => string) { | ||
const ret = origImpl(value) | ||
if (value === '' && ret === '``') { | ||
const dem2 = '\'' | ||
// original IFNULL(user.distotal, 0) as foo | ||
// from: IFNULL(user => input: `IFNULL(user` fix to 'IFNULL(user | ||
// from: distotal, 0) => input: `distotal, 0)` fix to distotal, 0)' | ||
if (value.includes('(')) { | ||
const line = dem2 + value | ||
return line | ||
} | ||
if (value.includes(')')) { | ||
const line = value + dem2 | ||
return line | ||
} | ||
const upper = value.toUpperCase().trim() | ||
const matched = fnKeys.find(key => upper.includes(key)) | ||
if (matched) { | ||
if (upper.startsWith('CASE ')) { | ||
const line = dem2 + value | ||
return line | ||
} | ||
if (upper.endsWith(' END')) { | ||
const line = value + dem2 | ||
return line | ||
} | ||
} | ||
const line = origImpl(value) | ||
if (value === '' && line === '``') { | ||
return '\'\'' | ||
} | ||
return ret | ||
return line | ||
} | ||
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
404965
6808