<commit_before>import { Injectable } from '@angular/core';
import { CanActivate, ActivatedRouteSnapshot, RouterStateSnapshot, Router } from '@angular/router';
import { Observable } from 'rxjs/Observable';
import { of } from 'rxjs/observable/of';
import { BookService } from 'app/books/services';
import 'rxjs/add/operator/mergeMap';

@Injectable()
export class BookGuard implements CanActivate {
  constructor(
    private _router: Router,
    private _bookService: BookService,
  ) { }

  private existBook(id: string): Observable<boolean> {
    return this._bookService.getBook(id)
      .mergeMap(() => {
        return of(true);
      })
      .catch(error => {
        // TODO refactor to navigate to relative path
        this._router.navigate(['./404']);
        return of(false);
      });
  }

  canActivate(
    next: ActivatedRouteSnapshot,
    state: RouterStateSnapshot): Observable<boolean> {
    return this.existBook(next.params['id'] )
  }
}
<commit_msg>fixed(book guard): added missing semicolon<commit_after>import { Injectable } from '@angular/core';
import { CanActivate, ActivatedRouteSnapshot, RouterStateSnapshot, Router } from '@angular/router';
import { Observable } from 'rxjs/Observable';
import { of } from 'rxjs/observable/of';
import { BookService } from 'app/books/services';
import 'rxjs/add/operator/mergeMap';

@Injectable()
export class BookGuard implements CanActivate {
  constructor(
    private _router: Router,
    private _bookService: BookService,
  ) { }

  private existBook(id: string): Observable<boolean> {
    return this._bookService.getBook(id)
      .mergeMap(() => {
        return of(true);
      })
      .catch(error => {
        // TODO refactor to navigate to relative path
        this._router.navigate(['./404']);
        return of(false);
      });
  }

  canActivate(
    next: ActivatedRouteSnapshot,
    state: RouterStateSnapshot): Observable<boolean> {
    return this.existBook(next.params['id']);
  }
}

{'fraction_non_alphanumeric': 0.12886859462201927, 'fraction_numerical': 0.0030441400304414, 'mean_word_length': 3.650943396226415, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7640413', 'n_tokens_mistral': 587, 'n_tokens_neox': 580, 'n_words': 136}