<commit_before>var React = require('react');
var ReactDOM = require('react-dom');
var {Route, Router, IndexRoute, hashHistory} = require('react-router');
var Faker = require('faker');
var $ = require('jquery');
var ohwtAPI = require('ohwtAPI');

//Components
var Main = require('Main').default;
var UserProfile = require('UserProfile').default;
var Dashboard = require('Dashboard').default;
var HouseSummary = require('HouseSummary').default;
var Score = require('Score').default;
var HouseProfile = require('HouseProfile').default;
var AverageDistance = require('AverageDistance').default;
var Settings = require('Settings').default;
var Logout = require('Logout').default;
var AddHouse = require('AddHouse').default;
var Checklist = require('Checklist').default;
var Login = require('Login').default;
var Registration = require('Registration').default;
var Walkthru = require('Walkthru').default;
var NotFound = require('NotFound').default;
var ContactForm = require('ContactForm').default;

// Material UI
import injectTapEventPlugin from 'react-tap-event-plugin'

//Redux
var actions = require('actions');
var store = require('configureStore').configure();
var {Provider} = require('react-redux');

try {
    injectTapEventPlugin();
} catch (e) {
        //do Nothing, already injected
}

store.subscribe(() => {
    // Every time store changes, log it in the console
    console.log('New State', store.getState());
});


/*var randomIntFromInterval = function(min, max) {
    return Math.floor(Math.random()*(max-min+1)+min);
};*/
// Generate Initial Houses
/*var num = randomIntFromInterval(5, 10)
for (var x = 0; x < num; x++) {
    var house = {
        address :  Faker.address.streetAddress(),
        city : Faker.address.city(),
        state : Faker.address.state(),
        zipcode : Faker.address.zipCode(),
        description : Faker.lorem.sentences(),
        imageurl : Faker.image.image(),
        score : randomIntFromInterval(60, 100),
    }
    store.dispatch(actions.startAddHouse(house, 1));
}*/

//Load user ID
var userID = 1;

//Load Houses via userID
store.dispatch(actions.startLoadHouse(userID));

// Load Foundation
$(document).foundation();

//SCSS
require('applicationStyles');

// Function used to check that the URL the user is accessing
// has a house/checklist associated with it
const checkHouse = (store) => {
    return (nextState, replace) => {
        // Get URL -> get checklist/house id
        var nextLoc = nextState.location.pathname;
        var splitArray = nextLoc.split('/');
        var id = splitArray.slice(-1)[0];
        // otherLoc to determine where they were going (house or checklist)
        var otherLoc = splitArray.slice(-2)[0];
        var houses = store.getState().houses;
        if ($.isArray(houses)) {
            if (houses.length > 0) {
                var house = ohwtAPI.findHouseById(houses, id);
                if (house === null) {
                    replace({
                        pathname : '/notfound',
                        state : {notFound : otherLoc}
                    });
                } else {
                    // House was found, add it to redux state
                    store.dispatch(actions.addCurHouse(house));
                }
            }
            else {
                replace({
                    pathname : '/notfound',
                    state : {notFound : otherLoc}
                });
            }
        } else {
            replace({
                pathname : '/notfound',
                state : {notFound : otherLoc}
            });<commit_msg>changed some parameter checking code<commit_after>var React = require('react');
var ReactDOM = require('react-dom');
var {Route, Router, IndexRoute, hashHistory} = require('react-router');
var Faker = require('faker');
var $ = require('jquery');
var ohwtAPI = require('ohwtAPI');

//Components
var Main = require('Main').default;
var UserProfile = require('UserProfile').default;
var Dashboard = require('Dashboard').default;
var HouseSummary = require('HouseSummary').default;
var Score = require('Score').default;
var HouseProfile = require('HouseProfile').default;
var AverageDistance = require('AverageDistance').default;
var Settings = require('Settings').default;
var Logout = require('Logout').default;
var AddHouse = require('AddHouse').default;
var Checklist = require('Checklist').default;
var Login = require('Login').default;
var Registration = require('Registration').default;
var Walkthru = require('Walkthru').default;
var NotFound = require('NotFound').default;
var ContactForm = require('ContactForm').default;

// Material UI
import injectTapEventPlugin from 'react-tap-event-plugin'

//Redux
var actions = require('actions');
var store = require('configureStore').configure();
var {Provider} = require('react-redux');

try {
    injectTapEventPlugin();
} catch (e) {
        //do Nothing, already injected
}

store.subscribe(() => {
    // Every time store changes, log it in the console
    console.log('New State', store.getState());
});


/*var randomIntFromInterval = function(min, max) {
    return Math.floor(Math.random()*(max-min+1)+min);
};*/
// Generate Initial Houses
/*var num = randomIntFromInterval(5, 10)
for (var x = 0; x < num; x++) {
    var house = {
        address :  Faker.address.streetAddress(),
        city : Faker.address.city(),
        state : Faker.address.state(),
        zipcode : Faker.address.zipCode(),
        description : Faker.lorem.sentences(),
        imageurl : Faker.image.image(),
        score : randomIntFromInterval(60, 100),
    }
    store.dispatch(actions.startAddHouse(house, 1));
}*/

//Load user ID
var userID = 1;

//Load Houses via userID
store.dispatch(actions.startLoadHouse(userID));

// Load Foundation
$(document).foundation();

//SCSS
require('applicationStyles');
//Sleep function
function sleep(ms) {
  return new Promise(resolve => setTimeout(resolve, ms));
}


// Function used to check that the URL the user is accessing
// has a house/checklist associated with it
const checkHouse = (store) => {
    return (nextState, replace) => {
        // Get URL -> get checklist/house id
        var nextLoc = nextState.location.pathname;
        var splitArray = nextLoc.split('/');
        var id = splitArray.slice(-1)[0];
        // otherLoc to determine where they were going (house or checklist)
        var otherLoc = splitArray.slice(-2)[0];
        var houses = store.getState().houses;
        if ($.isArray(houses)) {
            if (houses.length > 0) {
                var house = ohwtAPI.findHouseById(houses, id);
                if (house === null) {
                    replace({
                        pathname : '/notfound',
                        state : {notFound : otherLoc}
                    });
                } else {
                    // House was found, add it to redux state
                    store.dispatch(actions.addCurHouse(house));
                }
            }
            else {
                sleep(1000).then(() => {
                    var houses = store.getState().houses;
                    replace({
                        pathname : '/notfound',
                        state : {notFound : otherLoc}
                    });
                });
            }
        } else {
            replace({
                pathname : '/notfound',
                state : {notFound : otherLoc}
            });
{'fraction_non_alphanumeric': 0.1388251181634031, 'fraction_numerical': 0.0051316677920324105, 'mean_word_length': 2.514950166112957, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 15, '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': '5845749', 'n_tokens_mistral': 2074, 'n_tokens_neox': 1971, 'n_words': 529}