<commit_before>/**
 * jspsych-survey-likert
 * a jspsych plugin for measuring items on a likert scale
 *
 * <NAME>
 *
 * documentation: docs.jspsych.org
 *
 */

(function($) {
  jsPsych['survey-likert'] = (function() {

    var plugin = {};

    plugin.create = function(params) {

      params = jsPsych.pluginAPI.enforceArray(params, ['data']);

      var trials = [];
      for (var i = 0; i < params.questions.length; i++) {
        trials.push({
          preamble: params.preamble[i] || "",
          questions: params.questions[i],
          labels: params.labels[i],
          intervals: params.intervals[i],
          show_ticks: (typeof params.show_ticks === 'undefined') ? true : params.show_ticks
        });
      }
      return trials;
    };

    plugin.trial = function(display_element, trial) {

      // if any trial variables are functions
      // this evaluates the function and replaces
      // it with the output of the function
      trial = jsPsych.pluginAPI.normalizeTrialVariables(trial);

      // show preamble text
      display_element.append($('<div>', {
        "id": 'jspsych-survey-likert-preamble',<commit_msg>bug fix for undefined preamble param<commit_after>/**
 * jspsych-survey-likert
 * a jspsych plugin for measuring items on a likert scale
 *
 * <NAME>
 *
 * documentation: docs.jspsych.org
 *
 */

(function($) {
  jsPsych['survey-likert'] = (function() {

    var plugin = {};

    plugin.create = function(params) {

      params = jsPsych.pluginAPI.enforceArray(params, ['data']);

      var trials = [];
      for (var i = 0; i < params.questions.length; i++) {
        trials.push({
          preamble: (typeof params.preamble === 'undefined') ? "" : params.preamble[i],
          questions: params.questions[i],
          labels: params.labels[i],
          intervals: params.intervals[i],
          show_ticks: (typeof params.show_ticks === 'undefined') ? true : params.show_ticks
        });
      }
      return trials;
    };

    plugin.trial = function(display_element, trial) {

      // if any trial variables are functions
      // this evaluates the function and replaces
      // it with the output of the function
      trial = jsPsych.pluginAPI.normalizeTrialVariables(trial);

      // show preamble text
      display_element.append($('<div>', {
        "id": 'jspsych-survey-likert-preamble',
{'fraction_non_alphanumeric': 0.13649851632047477, 'fraction_numerical': 0.000847816871555744, 'mean_word_length': 2.5649546827794563, 'pattern_counts': {'":': 2, '<': 9, '<?xml version=': 0, '>': 7, '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': '797279', 'n_tokens_mistral': 742, 'n_tokens_neox': 692, 'n_words': 169}