Skip to content

Commit 57f30b0

Browse files
committed
lint: use capitals for constants
1 parent c332169 commit 57f30b0

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

lib/SqlString.js

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
var SqlString = exports;
2-
var charsRegex = /[\0\b\t\n\r\x1a\"\'\\]/g; // eslint-disable-line no-control-regex
3-
var charsMap = {
2+
3+
var CHARS_GLOBAL_REGEXP = /[\0\b\t\n\r\x1a\"\'\\]/g; // eslint-disable-line no-control-regex
4+
var CHARS_ESCAPE_MAP = {
45
'\0' : '\\0',
56
'\b' : '\\b',
67
'\t' : '\\t',
@@ -177,13 +178,13 @@ SqlString.objectToValues = function objectToValues(object, timeZone) {
177178
};
178179

179180
function escapeString(val) {
180-
var chunkIndex = charsRegex.lastIndex = 0;
181+
var chunkIndex = CHARS_GLOBAL_REGEXP.lastIndex = 0;
181182
var escapedVal = '';
182183
var match;
183184

184-
while ((match = charsRegex.exec(val))) {
185-
escapedVal += val.slice(chunkIndex, match.index) + charsMap[match[0]];
186-
chunkIndex = charsRegex.lastIndex;
185+
while ((match = CHARS_GLOBAL_REGEXP.exec(val))) {
186+
escapedVal += val.slice(chunkIndex, match.index) + CHARS_ESCAPE_MAP[match[0]];
187+
chunkIndex = CHARS_GLOBAL_REGEXP.lastIndex;
187188
}
188189

189190
if (chunkIndex === 0) {

0 commit comments

Comments
 (0)