jspsych 7.3.1 → 7.3.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.browser.js +11 -14
- package/dist/index.browser.js.map +1 -1
- package/dist/index.browser.min.js +1 -1
- package/dist/index.browser.min.js.map +1 -1
- package/dist/index.cjs +11 -14
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +11 -14
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/JsPsych.ts +10 -13
package/dist/index.browser.js
CHANGED
|
@@ -70,7 +70,7 @@ var jsPsychModule = (function (exports) {
|
|
|
70
70
|
return self;
|
|
71
71
|
};
|
|
72
72
|
|
|
73
|
-
var version = "7.3.
|
|
73
|
+
var version = "7.3.2";
|
|
74
74
|
|
|
75
75
|
class MigrationError extends Error {
|
|
76
76
|
constructor(message = "The global `jsPsych` variable is no longer available in jsPsych v7.") {
|
|
@@ -3188,20 +3188,21 @@ var jsPsychModule = (function (exports) {
|
|
|
3188
3188
|
for (const param in trial.type.info.parameters) {
|
|
3189
3189
|
// check if parameter is complex with nested defaults
|
|
3190
3190
|
if (trial.type.info.parameters[param].type === exports.ParameterType.COMPLEX) {
|
|
3191
|
-
if
|
|
3191
|
+
// check if parameter is undefined and has a default value
|
|
3192
|
+
if (typeof trial[param] === "undefined" && trial.type.info.parameters[param].default) {
|
|
3193
|
+
trial[param] = trial.type.info.parameters[param].default;
|
|
3194
|
+
}
|
|
3195
|
+
// if parameter is an array, iterate over each entry after confirming that there are
|
|
3196
|
+
// entries to iterate over. this is common when some parameters in a COMPLEX type have
|
|
3197
|
+
// default values and others do not.
|
|
3198
|
+
if (trial.type.info.parameters[param].array === true && Array.isArray(trial[param])) {
|
|
3192
3199
|
// iterate over each entry in the array
|
|
3193
3200
|
trial[param].forEach(function (ip, i) {
|
|
3194
3201
|
// check each parameter in the plugin description
|
|
3195
3202
|
for (const p in trial.type.info.parameters[param].nested) {
|
|
3196
3203
|
if (typeof trial[param][i][p] === "undefined" || trial[param][i][p] === null) {
|
|
3197
3204
|
if (typeof trial.type.info.parameters[param].nested[p].default === "undefined") {
|
|
3198
|
-
console.error(
|
|
3199
|
-
p +
|
|
3200
|
-
" parameter (nested in the " +
|
|
3201
|
-
param +
|
|
3202
|
-
" parameter) in the " +
|
|
3203
|
-
trial.type +
|
|
3204
|
-
" plugin.");
|
|
3205
|
+
console.error(`You must specify a value for the ${p} parameter (nested in the ${param} parameter) in the ${trial.type.info.name} plugin.`);
|
|
3205
3206
|
}
|
|
3206
3207
|
else {
|
|
3207
3208
|
trial[param][i][p] = trial.type.info.parameters[param].nested[p].default;
|
|
@@ -3214,11 +3215,7 @@ var jsPsychModule = (function (exports) {
|
|
|
3214
3215
|
// if it's not nested, checking is much easier and do that here:
|
|
3215
3216
|
else if (typeof trial[param] === "undefined" || trial[param] === null) {
|
|
3216
3217
|
if (typeof trial.type.info.parameters[param].default === "undefined") {
|
|
3217
|
-
console.error(
|
|
3218
|
-
param +
|
|
3219
|
-
" parameter in the " +
|
|
3220
|
-
trial.type.info.name +
|
|
3221
|
-
" plugin.");
|
|
3218
|
+
console.error(`You must specify a value for the ${param} parameter in the ${trial.type.info.name} plugin.`);
|
|
3222
3219
|
}
|
|
3223
3220
|
else {
|
|
3224
3221
|
trial[param] = trial.type.info.parameters[param].default;
|