jspsych 7.3.2 → 7.3.4

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.
Files changed (35) hide show
  1. package/README.md +9 -3
  2. package/css/jspsych.css +2 -4
  3. package/dist/JsPsych.d.ts +112 -112
  4. package/dist/TimelineNode.d.ts +34 -34
  5. package/dist/index.browser.js +4061 -3117
  6. package/dist/index.browser.js.map +1 -1
  7. package/dist/index.browser.min.js +2 -2
  8. package/dist/index.browser.min.js.map +1 -1
  9. package/dist/index.cjs +4057 -3113
  10. package/dist/index.cjs.map +1 -1
  11. package/dist/index.d.ts +12 -12
  12. package/dist/index.js +4057 -3111
  13. package/dist/index.js.map +1 -1
  14. package/dist/migration.d.ts +3 -3
  15. package/dist/modules/data/DataCollection.d.ts +46 -46
  16. package/dist/modules/data/DataColumn.d.ts +15 -15
  17. package/dist/modules/data/index.d.ts +25 -25
  18. package/dist/modules/data/utils.d.ts +3 -3
  19. package/dist/modules/extensions.d.ts +22 -22
  20. package/dist/modules/plugin-api/HardwareAPI.d.ts +15 -15
  21. package/dist/modules/plugin-api/KeyboardListenerAPI.d.ts +34 -34
  22. package/dist/modules/plugin-api/MediaAPI.d.ts +32 -32
  23. package/dist/modules/plugin-api/SimulationAPI.d.ts +44 -41
  24. package/dist/modules/plugin-api/TimeoutAPI.d.ts +17 -5
  25. package/dist/modules/plugin-api/index.d.ts +8 -8
  26. package/dist/modules/plugins.d.ts +136 -136
  27. package/dist/modules/randomization.d.ts +42 -42
  28. package/dist/modules/turk.d.ts +40 -40
  29. package/dist/modules/utils.d.ts +13 -7
  30. package/package.json +3 -3
  31. package/src/JsPsych.ts +21 -8
  32. package/src/modules/plugin-api/SimulationAPI.ts +9 -4
  33. package/src/modules/plugin-api/TimeoutAPI.ts +15 -3
  34. package/src/modules/plugin-api/index.ts +14 -11
  35. package/src/modules/utils.ts +31 -0
@@ -28,3 +28,34 @@ export function deepCopy(obj) {
28
28
  return obj;
29
29
  }
30
30
  }
31
+
32
+ /**
33
+ * Merges two objects, recursively.
34
+ * @param obj1 Object to merge
35
+ * @param obj2 Object to merge
36
+ */
37
+ export function deepMerge(obj1: any, obj2: any): any {
38
+ let merged = {};
39
+ for (const key in obj1) {
40
+ if (obj1.hasOwnProperty(key)) {
41
+ if (typeof obj1[key] === "object" && obj2.hasOwnProperty(key)) {
42
+ merged[key] = deepMerge(obj1[key], obj2[key]);
43
+ } else {
44
+ merged[key] = obj1[key];
45
+ }
46
+ }
47
+ }
48
+ for (const key in obj2) {
49
+ if (obj2.hasOwnProperty(key)) {
50
+ if (!merged.hasOwnProperty(key)) {
51
+ merged[key] = obj2[key];
52
+ } else if (typeof obj2[key] === "object") {
53
+ merged[key] = deepMerge(merged[key], obj2[key]);
54
+ } else {
55
+ merged[key] = obj2[key];
56
+ }
57
+ }
58
+ }
59
+
60
+ return merged;
61
+ }