<commit_before>/*
      Version: 0.1.0
       Author: <NAME>
  Description: json quiz score calculator
 Dependencies: JQuery 2.1.0 (cdn here: https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js)
 */

(function(global, $, document) {

    'use strict';

    const VERSION = '1.0.0';

    let Quiz;

    // configuration for the plugin, these can be overwritten in the initialisation function:
    let config = {
        dataSource: '../examples/data/data.json',
        loadingGif: '../examples/img/loading.gif',
        id: 'quiz',
        randomise: false
    }

    let currentQuestion = 0;
    let questionCount = 0;
    let answerArray = [];
    let storedData = {};

    function extend(config, options) {
        for (let i in options) {
            config[i] = options[i];
        }
    }

    function isValid(data) {
        return true;
    }

    function getQuizData(url) {
        return $.getJSON(url);
    }

    function incrementQuestion() {

    }

    function getScore(answers) {
        let score = 0;

        answers.forEach((answer) => {
            score += parseInt(answer[0].value, 10);
        });
        return score;
    }

    function updateScore(userAnswer) {
        // map data to friendlier data set.
        answerArray.push(userAnswer);
    }

    function getTemplate(data, currentQuestion) {
        let question = data[0].questions[currentQuestion];
        if (currentQuestion === questionCount) {
            return end();
        };
        return questionTemplate(question.question, question.options);
    }

    function randomiseQuestions(questions) {
        let m = questions.length,
            t, i;
        while (m) {
            i = Math.floor(Math.random() * m--);
            t = questions[m];
            questions[m] = array[i];
            questions[i] = t;
        }
        return questions;
    }

    function start(data) {

        if (!isValid(data)) return;

        if (config.random) {
            randomiseQuestions(data);
        }
        
        questionCount = data[0].questions.length;

        storedData = data;
        if (config.randomise) {
            randomiseQuestions();<commit_msg>corrected version number<commit_after>/*
      Version: 0.1.0
       Author: <NAME>
  Description: json quiz score calculator
 Dependencies: JQuery 2.1.0 (cdn here: https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js)
 */

(function(global, $, document) {

    'use strict';

    const VERSION = '0.1.0';

    let Quiz;

    // configuration for the plugin, these can be overwritten in the initialisation function:
    let config = {
        dataSource: '../examples/data/data.json',
        loadingGif: '../examples/img/loading.gif',
        id: 'quiz',
        randomise: false
    }

    let currentQuestion = 0;
    let questionCount = 0;
    let answerArray = [];
    let storedData = {};

    function extend(config, options) {
        for (let i in options) {
            config[i] = options[i];
        }
    }

    function isValid(data) {
        return true;
    }

    function getQuizData(url) {
        return $.getJSON(url);
    }

    function incrementQuestion() {

    }

    function getScore(answers) {
        let score = 0;

        answers.forEach((answer) => {
            score += parseInt(answer[0].value, 10);
        });
        return score;
    }

    function updateScore(userAnswer) {
        // map data to friendlier data set.
        answerArray.push(userAnswer);
    }

    function getTemplate(data, currentQuestion) {
        let question = data[0].questions[currentQuestion];
        if (currentQuestion === questionCount) {
            return end();
        };
        return questionTemplate(question.question, question.options);
    }

    function randomiseQuestions(questions) {
        let m = questions.length,
            t, i;
        while (m) {
            i = Math.floor(Math.random() * m--);
            t = questions[m];
            questions[m] = array[i];
            questions[i] = t;
        }
        return questions;
    }

    function start(data) {

        if (!isValid(data)) return;

        if (config.random) {
            randomiseQuestions(data);
        }

        questionCount = data[0].questions.length;

        storedData = data;
        if (config.randomise) {
            randomiseQuestions();
{'fraction_non_alphanumeric': 0.12147604859041944, 'fraction_numerical': 0.009168003667201467, 'mean_word_length': 1.9035262807717896, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 7, 'https://': 2, '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': '4351570', 'n_tokens_mistral': 1314, 'n_tokens_neox': 1232, 'n_words': 293}