@@ -14,53 +14,53 @@ export class SimpleFileTokenCache implements adal.TokenCache {
14
14
this . load ( ) ;
15
15
}
16
16
17
- public add ( entries : any , cb ?: any ) {
17
+ public add ( entries : any [ ] , callback ?: ( err ?: Error , result ?: boolean ) => void ) {
18
18
this . entries . push ( ...entries ) ;
19
19
this . save ( ) ;
20
- if ( cb ) {
21
- cb ( ) ;
20
+ if ( callback ) {
21
+ callback ( ) ;
22
22
}
23
23
}
24
24
25
- public remove ( entries : any , cb ?: any ) {
25
+ public remove ( entries : any [ ] , callback ?: ( err ?: Error , result ?: null ) => void ) {
26
26
this . entries = this . entries . filter ( e => {
27
27
return ! Object . keys ( entries [ 0 ] ) . every ( key => e [ key ] === entries [ 0 ] [ key ] ) ;
28
28
} ) ;
29
29
this . save ( ) ;
30
- if ( cb ) {
31
- cb ( ) ;
30
+ if ( callback ) {
31
+ callback ( ) ;
32
32
}
33
33
}
34
34
35
- public find ( query : any , cb ?: any ) {
35
+ public find ( query : any , callback : ( err ?: Error , result ?: any [ ] ) => void ) {
36
36
let result = this . entries . filter ( e => {
37
37
return Object . keys ( query ) . every ( key => e [ key ] === query [ key ] ) ;
38
38
} ) ;
39
- cb ( null , result ) ;
39
+ callback ( null , result ) ;
40
40
return result ;
41
41
}
42
42
43
43
//-------- File toke cache specific methods
44
44
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 ) ;
49
49
if ( ! x ) {
50
- return acc . concat ( [ current ] ) ;
50
+ return accumulator . concat ( [ current ] ) ;
51
51
} else {
52
- return acc ;
52
+ return accumulator ;
53
53
}
54
54
} , [ ] ) ;
55
55
this . save ( ) ;
56
56
}
57
57
58
58
59
- public clear ( cb : any ) {
59
+ public clear ( callback : any ) {
60
60
this . entries = [ ] ;
61
61
this . subscriptions = [ ] ;
62
62
this . save ( ) ;
63
- cb ( ) ;
63
+ callback ( ) ;
64
64
}
65
65
66
66
public isEmpty ( ) {
0 commit comments