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.
- package/README.md +9 -3
- package/css/jspsych.css +2 -4
- package/dist/JsPsych.d.ts +112 -112
- package/dist/TimelineNode.d.ts +34 -34
- package/dist/index.browser.js +4061 -3117
- package/dist/index.browser.js.map +1 -1
- package/dist/index.browser.min.js +2 -2
- package/dist/index.browser.min.js.map +1 -1
- package/dist/index.cjs +4057 -3113
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +12 -12
- package/dist/index.js +4057 -3111
- package/dist/index.js.map +1 -1
- package/dist/migration.d.ts +3 -3
- package/dist/modules/data/DataCollection.d.ts +46 -46
- package/dist/modules/data/DataColumn.d.ts +15 -15
- package/dist/modules/data/index.d.ts +25 -25
- package/dist/modules/data/utils.d.ts +3 -3
- package/dist/modules/extensions.d.ts +22 -22
- package/dist/modules/plugin-api/HardwareAPI.d.ts +15 -15
- package/dist/modules/plugin-api/KeyboardListenerAPI.d.ts +34 -34
- package/dist/modules/plugin-api/MediaAPI.d.ts +32 -32
- package/dist/modules/plugin-api/SimulationAPI.d.ts +44 -41
- package/dist/modules/plugin-api/TimeoutAPI.d.ts +17 -5
- package/dist/modules/plugin-api/index.d.ts +8 -8
- package/dist/modules/plugins.d.ts +136 -136
- package/dist/modules/randomization.d.ts +42 -42
- package/dist/modules/turk.d.ts +40 -40
- package/dist/modules/utils.d.ts +13 -7
- package/package.json +3 -3
- package/src/JsPsych.ts +21 -8
- package/src/modules/plugin-api/SimulationAPI.ts +9 -4
- package/src/modules/plugin-api/TimeoutAPI.ts +15 -3
- package/src/modules/plugin-api/index.ts +14 -11
- package/src/modules/utils.ts +31 -0
package/src/modules/utils.ts
CHANGED
|
@@ -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
|
+
}
|