<commit_before>angular.module('bookApp', [])
  .controller('SearchBookController', function($http, $filter, $scope) {
    var bookSearch = this;

    function SetFields(options, inputName) {
      $("#" + inputName).closest("div").addClass("is-dirty");
      return options.constructor.toString().indexOf('Array') >= 0 ? options[0] : options;
    }

    bookSearch.search = function() {
      bookSearch.state = "loading...";
      $http.get("/api/isbn/" + bookSearch.isbn)
        .success(function(response){
          bookSearch.result = response;
          bookSearch.state = "";

          bookSearch.Title = SetFields(bookSearch.result.searchData.Title, "title");<commit_msg>handle undefined fields<commit_after>angular.module('bookApp', [])
  .controller('SearchBookController', function($http, $filter, $scope) {
    var bookSearch = this;

    function SetFields(options, inputName) {
      if (typeof options === 'undefined') return;
      $("#" + inputName).closest("div").addClass("is-dirty");
      return options.constructor.toString().indexOf('Array') >= 0 ? options[0] : options;
    }

    bookSearch.search = function() {
      bookSearch.state = "loading...";
      $http.get("/api/isbn/" + bookSearch.isbn)
        .success(function(response){
          bookSearch.result = response;
          bookSearch.state = "";

          bookSearch.Title = SetFields(bookSearch.result.searchData.Title, "title");
{'fraction_non_alphanumeric': 0.1659634317862166, 'fraction_numerical': 0.0028129395218002813, 'mean_word_length': 3.3784615384615386, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, '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': '3596279', 'n_tokens_mistral': 405, 'n_tokens_neox': 398, 'n_words': 66}