Skip to content

Commit 2522cd5

Browse files
committed
Adjust code to standard 13
1 parent a95c43b commit 2522cd5

File tree

10 files changed

+139
-139
lines changed

10 files changed

+139
-139
lines changed

src/client-integration.js

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ describe('browserbox integration tests', () => {
1919
plugins: ['STARTTLS', 'X-GM-EXT-1'],
2020
secureConnection: false,
2121
storage: {
22-
'INBOX': {
22+
INBOX: {
2323
messages: [
2424
{ raw: 'Subject: hello 1\r\n\r\nWorld 1!' },
2525
{ raw: 'Subject: hello 2\r\n\r\nWorld 2!', flags: ['\\Seen'] },
@@ -31,20 +31,20 @@ describe('browserbox integration tests', () => {
3131
]
3232
},
3333
'': {
34-
'separator': '/',
35-
'folders': {
34+
separator: '/',
35+
folders: {
3636
'[Gmail]': {
37-
'flags': ['\\Noselect'],
38-
'folders': {
37+
flags: ['\\Noselect'],
38+
folders: {
3939
'All Mail': { 'special-use': '\\All' },
40-
'Drafts': { 'special-use': '\\Drafts' },
41-
'Important': { 'special-use': '\\Important' },
40+
Drafts: { 'special-use': '\\Drafts' },
41+
Important: { 'special-use': '\\Important' },
4242
'Sent Mail': { 'special-use': '\\Sent' },
43-
'Spam': { 'special-use': '\\Junk' },
44-
'Starred': { 'special-use': '\\Flagged' },
45-
'Trash': { 'special-use': '\\Trash' },
46-
'A': { messages: [{}] },
47-
'B': { messages: [{}] }
43+
Spam: { 'special-use': '\\Junk' },
44+
Starred: { 'special-use': '\\Flagged' },
45+
Trash: { 'special-use': '\\Trash' },
46+
A: { messages: [{}] },
47+
B: { messages: [{}] }
4848
}
4949
}
5050
}
@@ -252,7 +252,7 @@ describe('browserbox integration tests', () => {
252252
return imap.setFlags('inbox', '1', ['\\Seen', '$MyFlag']).then((result) => {
253253
expect(result).to.deep.equal([{
254254
'#': 1,
255-
'flags': ['\\Seen', '$MyFlag']
255+
flags: ['\\Seen', '$MyFlag']
256256
}])
257257
})
258258
})
@@ -263,7 +263,7 @@ describe('browserbox integration tests', () => {
263263
}).then((result) => {
264264
expect(result).to.deep.equal([{
265265
'#': 2,
266-
'flags': ['\\Seen', '$MyFlag']
266+
flags: ['\\Seen', '$MyFlag']
267267
}])
268268
})
269269
})
@@ -276,8 +276,8 @@ describe('browserbox integration tests', () => {
276276
}).then((result) => {
277277
expect(result).to.deep.equal([{
278278
'#': 5,
279-
'flags': ['$MyFlag'],
280-
'uid': 557
279+
flags: ['$MyFlag'],
280+
uid: 557
281281
}])
282282
})
283283
})

src/client-unit.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1224,8 +1224,8 @@ describe('browserbox unit tests', () => {
12241224
expect(type).to.equal('fetch')
12251225
expect(value).to.deep.equal({
12261226
'#': 123,
1227-
'flags': ['\\Seen'],
1228-
'modseq': '4'
1227+
flags: ['\\Seen'],
1228+
modseq: '4'
12291229
})
12301230
done()
12311231
}

src/client.js

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ export default class Client {
149149
*/
150150
openConnection () {
151151
return new Promise((resolve, reject) => {
152-
let connectionTimeout = setTimeout(() => reject(new Error('Timeout connecting to server')), this.timeoutConnection)
152+
const connectionTimeout = setTimeout(() => reject(new Error('Timeout connecting to server')), this.timeoutConnection)
153153
this.logger.debug('Connecting to', this.client.host, ':', this.client.port)
154154
this._changeState(STATE_CONNECTING)
155155
this.client.connect().then(() => {
@@ -217,7 +217,7 @@ export default class Client {
217217
this.logger.debug('Updating id...')
218218

219219
const command = 'ID'
220-
const attributes = id ? [ flatten(Object.entries(id)) ] : [ null ]
220+
const attributes = id ? [flatten(Object.entries(id))] : [null]
221221
const response = await this.exec({ command, attributes }, 'ID')
222222
const list = flatten(pathOr([], ['payload', 'ID', '0', 'attributes', '0'], response).map(Object.values))
223223
const keys = list.filter((_, i) => i % 2 === 0)
@@ -255,7 +255,7 @@ export default class Client {
255255
* @returns {Promise} Promise with information about the selected mailbox
256256
*/
257257
async selectMailbox (path, options = {}) {
258-
let query = {
258+
const query = {
259259
command: options.readOnly ? 'EXAMINE' : 'SELECT',
260260
attributes: [{ type: 'STRING', value: path }]
261261
}
@@ -266,7 +266,7 @@ export default class Client {
266266

267267
this.logger.debug('Opening', path, '...')
268268
const response = await this.exec(query, ['EXISTS', 'FLAGS', 'OK'], { ctx: options.ctx })
269-
let mailboxInfo = parseSELECT(response)
269+
const mailboxInfo = parseSELECT(response)
270270

271271
this._changeState(STATE_SELECTED)
272272

@@ -493,8 +493,8 @@ export default class Client {
493493
* @returns {Promise} Promise with the array of matching seq. or uid numbers
494494
*/
495495
async upload (destination, message, options = {}) {
496-
let flags = propOr(['\\Seen'], 'flags', options).map(value => ({ type: 'atom', value }))
497-
let command = {
496+
const flags = propOr(['\\Seen'], 'flags', options).map(value => ({ type: 'atom', value }))
497+
const command = {
498498
command: 'APPEND',
499499
attributes: [
500500
{ type: 'atom', value: destination },
@@ -639,7 +639,7 @@ export default class Client {
639639
*/
640640
async login (auth) {
641641
let command
642-
let options = {}
642+
const options = {}
643643

644644
if (!auth) {
645645
throw new Error('Authentication information not provided')
@@ -842,7 +842,7 @@ export default class Client {
842842
* @param {Function} next Until called, server responses are not processed
843843
*/
844844
_untaggedExistsHandler (response) {
845-
if (response && response.hasOwnProperty('nr')) {
845+
if (response && Object.prototype.hasOwnProperty.call(response, 'nr')) {
846846
this.onupdate && this.onupdate(this._selectedMailbox, 'exists', response.nr)
847847
}
848848
}
@@ -854,7 +854,7 @@ export default class Client {
854854
* @param {Function} next Until called, server responses are not processed
855855
*/
856856
_untaggedExpungeHandler (response) {
857-
if (response && response.hasOwnProperty('nr')) {
857+
if (response && Object.prototype.hasOwnProperty.call(response, 'nr')) {
858858
this.onupdate && this.onupdate(this._selectedMailbox, 'expunge', response.nr)
859859
}
860860
}

0 commit comments

Comments
 (0)