Skip to content

Commit

Permalink
fix: πŸ› remove logger
Browse files Browse the repository at this point in the history
βœ… Closes: #41
  • Loading branch information
NetanelBasal committed Jul 18, 2021
1 parent 1bef772 commit d6672ff
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 33 deletions.
3 changes: 1 addition & 2 deletions projects/ngneat/cashew/ng-package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,5 @@
"dest": "../../../dist/ngneat/cashew",
"lib": {
"entryFile": "src/public-api.ts"
},
"allowedNonPeerDependencies": ["debug"]
}
}
3 changes: 0 additions & 3 deletions projects/ngneat/cashew/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,6 @@
"bugs": {
"url": "https://github.com/ngneat/cashew/issues"
},
"dependencies": {
"debug": "4.3.1"
},
"peerDependencies": {
"@angular/core": ">=12.0.0"
},
Expand Down
28 changes: 0 additions & 28 deletions projects/ngneat/cashew/src/lib/cache-interceptor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,6 @@ import { KeySerializer } from './key-serializer';
import { CACHE_CONTEXT } from './cache-context';
import { isPlatformServer } from '@angular/common';

let log: any;

// @ts-ignore
if (process.env.NODE_ENV === 'development') {
// @ts-ignore
log = require('debug')('http-cache:');
}

@Injectable()
export class HttpCacheInterceptor implements HttpInterceptor {
constructor(
Expand Down Expand Up @@ -51,11 +43,6 @@ export class HttpCacheInterceptor implements HttpInterceptor {

if (currentVersion !== version) {
this.httpCacheManager.delete(key);

// @ts-ignore
if (process.env.NODE_ENV === 'development') {
log(`New version for key: ${key}`);
}
}

versions.set(key, version);
Expand All @@ -67,11 +54,6 @@ export class HttpCacheInterceptor implements HttpInterceptor {

if (clearCache) {
this.httpCacheManager.delete(key, { deleteRequests: false, deleteVersions: false });

// @ts-ignore
if (process.env.NODE_ENV === 'development') {
log(`clearCachePredicate is true for key: ${key}`);
}
}
}

Expand All @@ -83,20 +65,10 @@ export class HttpCacheInterceptor implements HttpInterceptor {
bucket && bucket.add(key);

if (queue.has(key)) {
// @ts-ignore
if (process.env.NODE_ENV === 'development') {
log(`${key} was returned from the queue`);
}

return queue.get(key)!;
}

if (this.httpCacheManager.validate(key)) {
// @ts-ignore
if (process.env.NODE_ENV === 'development') {
log(`${key} was returned from the cache`);
}

return mode === 'stateManagement' ? returnSource! : of(this.httpCacheManager.get(key));
}

Expand Down

0 comments on commit d6672ff

Please sign in to comment.