Skip to content
This repository was archived by the owner on Dec 9, 2024. It is now read-only.

Commit 6dadb40

Browse files
committed
Address more pr feedback
1 parent 4771971 commit 6dadb40

File tree

1 file changed

+16
-16
lines changed

1 file changed

+16
-16
lines changed

src/plugins/login/utils/simpleFileTokenCache.ts

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -14,53 +14,53 @@ export class SimpleFileTokenCache implements adal.TokenCache {
1414
this.load();
1515
}
1616

17-
public add(entries: any, cb?: any) {
17+
public add(entries: any[], callback?: (err?: Error, result?: boolean) => void) {
1818
this.entries.push(...entries);
1919
this.save();
20-
if (cb) {
21-
cb();
20+
if (callback) {
21+
callback();
2222
}
2323
}
2424

25-
public remove(entries: any, cb?: any) {
25+
public remove(entries: any[], callback?: (err?: Error, result?: null) => void) {
2626
this.entries = this.entries.filter(e => {
2727
return !Object.keys(entries[0]).every(key => e[key] === entries[0][key]);
2828
});
2929
this.save();
30-
if (cb) {
31-
cb();
30+
if (callback) {
31+
callback();
3232
}
3333
}
3434

35-
public find(query: any, cb?: any) {
35+
public find(query: any, callback: (err?: Error, result?: any[]) => void) {
3636
let result = this.entries.filter(e => {
3737
return Object.keys(query).every(key => e[key] === query[key]);
3838
});
39-
cb(null, result);
39+
callback(null, result);
4040
return result;
4141
}
4242

4343
//-------- File toke cache specific methods
4444

45-
public addSubs(entries: any) {
46-
this.subscriptions.push(...entries);
47-
this.subscriptions = this.subscriptions.reduce((acc, current) => {
48-
const x = acc.find(item => item.id === current.id);
45+
public addSubs(subscriptions: any) {
46+
this.subscriptions.push(...subscriptions);
47+
this.subscriptions = this.subscriptions.reduce((accumulator , current) => {
48+
const x = accumulator .find(item => item.id === current.id);
4949
if (!x) {
50-
return acc.concat([current]);
50+
return accumulator .concat([current]);
5151
} else {
52-
return acc;
52+
return accumulator ;
5353
}
5454
}, []);
5555
this.save();
5656
}
5757

5858

59-
public clear(cb: any) {
59+
public clear(callback: any) {
6060
this.entries = [];
6161
this.subscriptions = [];
6262
this.save();
63-
cb();
63+
callback();
6464
}
6565

6666
public isEmpty() {

0 commit comments

Comments
 (0)