Skip to content

Commit 52a7690

Browse files
committed
lint
1 parent bbf0de1 commit 52a7690

File tree

4 files changed

+20
-19
lines changed

4 files changed

+20
-19
lines changed

lib/connection.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ const Backend = require('./backend.js')
55
const Queue = require('./queue.js')
66
const { errors } = require('./types.js')
77

8-
module.exports = Connection;
8+
module.exports = Connection
99

1010
function Connection(options = {}) {
1111
const {

lib/index.js

+7-5
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ Object.assign(Postgres, {
3434
toKebab
3535
})
3636

37-
module.exports = Postgres;
37+
module.exports = Postgres
3838

3939
function Postgres(url, options) {
4040
options = parseOptions(url, options)
@@ -143,7 +143,9 @@ function Postgres(url, options) {
143143
}
144144

145145
function next() {
146-
let c, x
146+
let c
147+
, x
148+
147149
while (queries.length && (c = getConnection(queries.peek().fn)) && (x = queries.shift())) {
148150
x.fn
149151
? transaction(x, c)
@@ -371,9 +373,9 @@ function Postgres(url, options) {
371373
if (first !== null && typeof first === 'object' && typeof first[0] !== 'string') {
372374
if (isInsert.test(str))
373375
return insertHelper(first, rest, xargs, types)
374-
else if(isSelect.test(str))
376+
else if (isSelect.test(str))
375377
return selectHelper(first, rest, xargs, types)
376-
else if(!Array.isArray(first))
378+
else if (!Array.isArray(first))
377379
return equalsHelper(first, rest, xargs, types)
378380
}
379381

@@ -423,7 +425,7 @@ function Postgres(url, options) {
423425

424426
function addValue(x, xargs, types) {
425427
const type = getType(x)
426-
, i = types.push(type-type)
428+
, i = types.push(type.type)
427429

428430
if (i > 65534)
429431
throw errors.generic({ message: 'Max number of parameters (65534) exceeded', code: 'MAX_PARAMETERS_EXCEEDED' })

lib/queue.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
module.exports = Queue;
1+
module.exports = Queue
22

33
function Queue() {
44
let xs = []
@@ -9,7 +9,7 @@ function Queue() {
99
return xs.length - index
1010
},
1111
push: (x) => xs.push(x),
12-
peek: (x) => xs[index],
12+
peek: () => xs[index],
1313
shift: () => {
1414
if (index === xs.length) {
1515
index = -1

lib/types.js

+10-11
Original file line numberDiff line numberDiff line change
@@ -69,17 +69,16 @@ module.exports.escape = function escape(str) {
6969
let result = ''
7070
let q = str[0] < 10 || str[0] === '$'
7171
let last = 0
72-
let char
73-
let code
72+
let c
7473

7574
for (let i = 0; i < str.length; i++) {
76-
const char = str[i]
77-
const code = char.charCodeAt(0)
75+
c = str[i].charCodeAt(0)
7876
if (str[i] === '"') {
7977
q = true
8078
result += str.slice(last, i) + '"'
8179
last = i
82-
} else if (code === 96 || (code !== 36 && code <= 47) || (code >= 58 && code <= 64) || (code >= 91 && code <= 94) || (code >= 123 && code <= 128)) {
80+
} else if (c === 96 || (c !== 36 && c <= 47) || (c >= 58 && c <= 64)
81+
|| (c >= 91 && c <= 94) || (c >= 123 && c <= 128)) {
8382
q = true
8483
}
8584
}
@@ -168,23 +167,23 @@ function arrayParserLoop(s, x, parser) {
168167
return xs
169168
}
170169

171-
const toCamel = module.exports.toCamel = x => {
170+
module.exports.toCamel = x => {
172171
let str = x[0]
173172
for (let i = 1; i < x.length; i++)
174173
str += x[i] === '_' ? x[++i].toUpperCase() : x[i]
175174
return str
176175
}
177176

178-
const toPascal = module.exports.toPascal = x => {
177+
module.exports.toPascal = x => {
179178
let str = x[0].toUpperCase()
180179
for (let i = 1; i < x.length; i++)
181180
str += x[i] === '_' ? x[++i].toUpperCase() : x[i]
182181
return str
183182
}
184183

185-
const toKebab = module.exports.toKebab = x => x.replace(/_/g, '-')
184+
module.exports.toKebab = x => x.replace(/_/g, '-')
186185

187-
const errors = module.exports.errors = {
186+
module.exports.errors = {
188187
connection: (x, options) => Object.assign(
189188
new Error('write CONNECTION_' + x + ' ' + options.path || (options.host + ':' + options.port)),
190189
{
@@ -207,7 +206,7 @@ const errors = module.exports.errors = {
207206
)
208207
}
209208

210-
const errorFields = module.exports.errorFields = Object.entries({
209+
module.exports.errorFields = Object.entries({
211210
S: 'severity_local',
212211
V: 'severity',
213212
C: 'code',
@@ -228,7 +227,7 @@ const errorFields = module.exports.errorFields = Object.entries({
228227
R: 'routine'
229228
}).reduce(char, {})
230229

231-
const arrayTypes = module.exports.arrayTypes = {
230+
module.exports.arrayTypes = {
232231
1000: 16,
233232
1001: 17,
234233
1002: 18,

0 commit comments

Comments
 (0)