jspsych 8.0.2 → 8.0.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.browser.js +3 -3
- 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 +2 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +19 -6
- package/dist/index.js +2 -2
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
- package/src/modules/randomization.ts +29 -10
package/dist/index.d.ts
CHANGED
|
@@ -742,11 +742,11 @@ type PluginAPI = ReturnType<typeof createJointPluginAPIObject>;
|
|
|
742
742
|
*/
|
|
743
743
|
declare function setSeed(seed?: string): string;
|
|
744
744
|
declare function repeat(array: any, repetitions: any, unpack?: boolean): any;
|
|
745
|
-
declare function shuffle(array: Array<
|
|
746
|
-
declare function shuffleNoRepeats(arr: Array<
|
|
747
|
-
declare function shuffleAlternateGroups(arr_groups:
|
|
748
|
-
declare function sampleWithoutReplacement(arr:
|
|
749
|
-
declare function sampleWithReplacement(arr:
|
|
745
|
+
declare function shuffle<T>(array: Array<T>): T[];
|
|
746
|
+
declare function shuffleNoRepeats<T>(arr: Array<T>, equalityTest: (a: T, b: T) => boolean): T[];
|
|
747
|
+
declare function shuffleAlternateGroups<T extends any[]>(arr_groups: Array<T>, random_group_order?: boolean): any[];
|
|
748
|
+
declare function sampleWithoutReplacement<T>(arr: Array<T>, size: number): T[];
|
|
749
|
+
declare function sampleWithReplacement<T>(arr: Array<T>, size: number, weights?: number[]): any[];
|
|
750
750
|
declare function factorial(factors: Record<string, any>, repetitions?: number, unpack?: boolean): any;
|
|
751
751
|
declare function randomID(length?: number): string;
|
|
752
752
|
/**
|
|
@@ -765,6 +765,19 @@ declare function sampleBernoulli(p: number): 0 | 1;
|
|
|
765
765
|
declare function sampleNormal(mean: number, standard_deviation: number): number;
|
|
766
766
|
declare function sampleExponential(rate: number): number;
|
|
767
767
|
declare function sampleExGaussian(mean: number, standard_deviation: number, rate: number, positive?: boolean): number;
|
|
768
|
+
type RandomWordsOptions = {
|
|
769
|
+
min?: number;
|
|
770
|
+
max?: number;
|
|
771
|
+
exactly?: number;
|
|
772
|
+
maxLength?: number;
|
|
773
|
+
wordsPerString?: number;
|
|
774
|
+
seperator?: string;
|
|
775
|
+
formatter?: (word: string, index: number) => string;
|
|
776
|
+
join?: string;
|
|
777
|
+
};
|
|
778
|
+
type RandomWordsResult<T extends RandomWordsOptions> = T extends {
|
|
779
|
+
join: string;
|
|
780
|
+
} ? string : string[];
|
|
768
781
|
/**
|
|
769
782
|
* Generate one or more random words.
|
|
770
783
|
*
|
|
@@ -775,7 +788,7 @@ declare function sampleExGaussian(mean: number, standard_deviation: number, rate
|
|
|
775
788
|
*
|
|
776
789
|
* @returns An array of words or a single string, depending on parameter choices.
|
|
777
790
|
*/
|
|
778
|
-
declare function randomWords(opts:
|
|
791
|
+
declare function randomWords<T extends RandomWordsOptions>(opts: T): RandomWordsResult<T>;
|
|
779
792
|
|
|
780
793
|
declare const randomization_setSeed: typeof setSeed;
|
|
781
794
|
declare const randomization_repeat: typeof repeat;
|
package/dist/index.js
CHANGED
|
@@ -4,7 +4,7 @@ import seedrandom from 'seedrandom/lib/alea';
|
|
|
4
4
|
|
|
5
5
|
var _package = {
|
|
6
6
|
name: "jspsych",
|
|
7
|
-
version: "8.0.
|
|
7
|
+
version: "8.0.3",
|
|
8
8
|
description: "Behavioral experiments in a browser",
|
|
9
9
|
type: "module",
|
|
10
10
|
main: "dist/index.cjs",
|
|
@@ -52,7 +52,7 @@ var _package = {
|
|
|
52
52
|
},
|
|
53
53
|
devDependencies: {
|
|
54
54
|
"@fontsource/open-sans": "4.5.3",
|
|
55
|
-
"@jspsych/config": "^3.0.
|
|
55
|
+
"@jspsych/config": "^3.0.1",
|
|
56
56
|
"@types/dom-mediacapture-record": "^1.0.11",
|
|
57
57
|
"base64-inline-loader": "^2.0.1",
|
|
58
58
|
"css-loader": "^6.6.0",
|