<commit_before>;(function(window,document,undefined){
  'use strict'
  
  var templater = require('./Templater');
  var store = require('./Store');
  var searcher = require('./Searcher');
  var JSONLoader = require('./JSONLoader');

  window.SimpleJekyllSearch = function SimpleJekyllSearch(){
    var self = this;

    var requiredOptions = [
      'searchInput',
      'resultsContainer',
      'dataSource',
    ];
    var opt = {
      searchInput: null,
      resultsContainer: null,
      dataSource: null,
      searchResultTemplate: '<li><a href="{url}" title="{desc}">{title}</a></li>',
      noResultsText: 'No results found',
      limit: 10,
      fuzzy: false,
    };


    self.init = function(_opt){
      validateOptions(_opt);
      assignOptions(_opt);
      if( !isJSON(opt.dataSource) ){
        JSONLoader.load(opt.dataSource, function gotJSON(err,json){
          if( !err ){
            store.put(json);
          }else{
            throwError('failed to get JSON (' + opt.dataSource + ')');
          }
        });
      }else{
        store.put(opt.dataSource);
      }
    };


    function throwError(message){ throw new Error('SimpleJekyllSearch --- '+ message); }

    function validateOptions(_opt){
      for (var i = 0, req = requiredOptions[i]; i < requiredOptions.length; i++)
        if( !_opt[req] ) throwError('You must specify a ' + req);
    }

    function assignOptions(_opt){
      for(var option in opt) opt[option] = _opt[option] || opt[option];
    }

    function isJSON(json){
      try{
        JSON.parse(JSON.stringify(json));<commit_msg>removed short braces<commit_after>;(function(window,document,undefined){
  'use strict'
  
  var templater = require('./Templater');
  var store = require('./Store');
  var searcher = require('./Searcher');
  var JSONLoader = require('./JSONLoader');

  window.SimpleJekyllSearch = function SimpleJekyllSearch(){
    var self = this;

    var requiredOptions = [
      'searchInput',
      'resultsContainer',
      'dataSource',
    ];
    var opt = {
      searchInput: null,
      resultsContainer: null,
      dataSource: null,
      searchResultTemplate: '<li><a href="{url}" title="{desc}">{title}</a></li>',
      noResultsText: 'No results found',
      limit: 10,
      fuzzy: false,
    };


    self.init = function(_opt){
      validateOptions(_opt);
      assignOptions(_opt);
      if( !isJSON(opt.dataSource) ){
        JSONLoader.load(opt.dataSource, function gotJSON(err,json){
          if( !err )
            store.put(json);
          else
            throwError('failed to get JSON (' + opt.dataSource + ')');
        });
      }else{
        store.put(opt.dataSource);
      }
    };


    function throwError(message){ throw new Error('SimpleJekyllSearch --- '+ message); }

    function validateOptions(_opt){
      for (var i = 0, req = requiredOptions[i]; i < requiredOptions.length; i++)
        if( !_opt[req] ) throwError('You must specify a ' + req);
    }

    function assignOptions(_opt){
      for(var option in opt) opt[option] = _opt[option] || opt[option];
    }

    function isJSON(json){
      try{
        JSON.parse(JSON.stringify(json));
{'fraction_non_alphanumeric': 0.14898989898989898, 'fraction_numerical': 0.001893939393939394, 'mean_word_length': 2.625858123569794, 'pattern_counts': {'":': 0, '<': 13, '<?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': '4686592', 'n_tokens_mistral': 957, 'n_tokens_neox': 935, 'n_words': 207}