jspsych 8.2.2 → 8.2.3

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.cjs CHANGED
@@ -4,7 +4,7 @@ var autoBind = require('auto-bind');
4
4
  var rw = require('random-words');
5
5
  var seedrandom = require('seedrandom/lib/alea.js');
6
6
 
7
- var version = "8.2.2";
7
+ var version = "8.2.3";
8
8
 
9
9
  class ExtensionManager {
10
10
  constructor(dependencies, extensionsConfiguration) {
@@ -2066,6 +2066,73 @@ class Trial extends TimelineNode {
2066
2066
  }
2067
2067
  }
2068
2068
  });
2069
+ if (!parameterConfig.array && parameterValue !== null) {
2070
+ switch (parameterConfig.type) {
2071
+ case ParameterType.BOOL:
2072
+ if (typeof parameterValue !== "boolean") {
2073
+ const parameterPathString = parameterPathArrayToString(parameterPath);
2074
+ console.warn(
2075
+ `A non-boolean value (\`${parameterValue}\`) was provided for the boolean parameter "${parameterPathString}" in the "${this.pluginInfo.name}" plugin.`
2076
+ );
2077
+ }
2078
+ break;
2079
+ // @ts-ignore falls through
2080
+ case ParameterType.KEYS:
2081
+ if (Array.isArray(parameterValue)) break;
2082
+ case ParameterType.STRING:
2083
+ case ParameterType.HTML_STRING:
2084
+ case ParameterType.KEY:
2085
+ case ParameterType.AUDIO:
2086
+ case ParameterType.VIDEO:
2087
+ case ParameterType.IMAGE:
2088
+ if (typeof parameterValue !== "string") {
2089
+ const parameterPathString = parameterPathArrayToString(parameterPath);
2090
+ console.warn(
2091
+ `A non-string value (\`${parameterValue}\`) was provided for the parameter "${parameterPathString}" in the "${this.pluginInfo.name}" plugin.`
2092
+ );
2093
+ }
2094
+ break;
2095
+ case ParameterType.FLOAT:
2096
+ case ParameterType.INT:
2097
+ if (typeof parameterValue !== "number") {
2098
+ const parameterPathString = parameterPathArrayToString(parameterPath);
2099
+ console.warn(
2100
+ `A non-numeric value (\`${parameterValue}\`) was provided for the numeric parameter "${parameterPathString}" in the "${this.pluginInfo.name}" plugin.`
2101
+ );
2102
+ }
2103
+ break;
2104
+ case ParameterType.FUNCTION:
2105
+ if (typeof parameterValue !== "function") {
2106
+ const parameterPathString = parameterPathArrayToString(parameterPath);
2107
+ console.warn(
2108
+ `A non-function value (\`${parameterValue}\`) was provided for the function parameter "${parameterPathString}" in the "${this.pluginInfo.name}" plugin.`
2109
+ );
2110
+ }
2111
+ break;
2112
+ case ParameterType.SELECT:
2113
+ if (!parameterConfig.options) {
2114
+ const parameterPathString = parameterPathArrayToString(parameterPath);
2115
+ console.warn(
2116
+ `The "options" array is required for the "select" parameter "${parameterPathString}" in the "${this.pluginInfo.name}" plugin.`
2117
+ );
2118
+ }
2119
+ }
2120
+ if (parameterConfig.type === ParameterType.INT && parameterValue % 1 !== 0) {
2121
+ const parameterPathString = parameterPathArrayToString(parameterPath);
2122
+ console.warn(
2123
+ `A float value (\`${parameterValue}\`) was provided for the integer parameter "${parameterPathString}" in the "${this.pluginInfo.name}" plugin. The value will be truncated to an integer.`
2124
+ );
2125
+ parameterValue = Math.trunc(parameterValue);
2126
+ }
2127
+ }
2128
+ if (parameterConfig.type === ParameterType.SELECT) {
2129
+ if (!parameterConfig.options.includes(parameterValue)) {
2130
+ const parameterPathString = parameterPathArrayToString(parameterPath);
2131
+ console.warn(
2132
+ `The value "${parameterValue}" is not a valid option for the parameter "${parameterPathString}" in the "${this.pluginInfo.name}" plugin. Valid options are: ${parameterConfig.options.join(", ")}.`
2133
+ );
2134
+ }
2135
+ }
2069
2136
  if (parameterConfig.array && !Array.isArray(parameterValue)) {
2070
2137
  const parameterPathString = parameterPathArrayToString(parameterPath);
2071
2138
  throw new Error(