jspsych 7.2.1 → 7.2.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.cjs CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- /*! *****************************************************************************
5
+ /******************************************************************************
6
6
  Copyright (c) Microsoft Corporation.
7
7
 
8
8
  Permission to use, copy, modify, and/or distribute this software for any
@@ -71,7 +71,7 @@ var autoBind = (self, {include, exclude} = {}) => {
71
71
  return self;
72
72
  };
73
73
 
74
- var version = "7.2.1";
74
+ var version = "7.2.2";
75
75
 
76
76
  class MigrationError extends Error {
77
77
  constructor(message = "The global `jsPsych` variable is no longer available in jsPsych v7.") {
@@ -1631,119 +1631,119 @@ words.wordList = wordList;
1631
1631
  var alea = {exports: {}};
1632
1632
 
1633
1633
  (function (module) {
1634
- // A port of an algorithm by Johannes Baagøe <baagoe@baagoe.com>, 2010
1635
- // http://baagoe.com/en/RandomMusings/javascript/
1636
- // https://github.com/nquinlan/better-random-numbers-for-javascript-mirror
1637
- // Original work is under MIT license -
1638
-
1639
- // Copyright (C) 2010 by Johannes Baagøe <baagoe@baagoe.org>
1640
- //
1641
- // Permission is hereby granted, free of charge, to any person obtaining a copy
1642
- // of this software and associated documentation files (the "Software"), to deal
1643
- // in the Software without restriction, including without limitation the rights
1644
- // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
1645
- // copies of the Software, and to permit persons to whom the Software is
1646
- // furnished to do so, subject to the following conditions:
1647
- //
1648
- // The above copyright notice and this permission notice shall be included in
1649
- // all copies or substantial portions of the Software.
1650
- //
1651
- // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
1652
- // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
1653
- // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
1654
- // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
1655
- // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
1656
- // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
1657
- // THE SOFTWARE.
1658
-
1659
-
1660
-
1661
- (function(global, module, define) {
1662
-
1663
- function Alea(seed) {
1664
- var me = this, mash = Mash();
1665
-
1666
- me.next = function() {
1667
- var t = 2091639 * me.s0 + me.c * 2.3283064365386963e-10; // 2^-32
1668
- me.s0 = me.s1;
1669
- me.s1 = me.s2;
1670
- return me.s2 = t - (me.c = t | 0);
1671
- };
1672
-
1673
- // Apply the seeding algorithm from Baagoe.
1674
- me.c = 1;
1675
- me.s0 = mash(' ');
1676
- me.s1 = mash(' ');
1677
- me.s2 = mash(' ');
1678
- me.s0 -= mash(seed);
1679
- if (me.s0 < 0) { me.s0 += 1; }
1680
- me.s1 -= mash(seed);
1681
- if (me.s1 < 0) { me.s1 += 1; }
1682
- me.s2 -= mash(seed);
1683
- if (me.s2 < 0) { me.s2 += 1; }
1684
- mash = null;
1685
- }
1686
-
1687
- function copy(f, t) {
1688
- t.c = f.c;
1689
- t.s0 = f.s0;
1690
- t.s1 = f.s1;
1691
- t.s2 = f.s2;
1692
- return t;
1693
- }
1634
+ // A port of an algorithm by Johannes Baagøe <baagoe@baagoe.com>, 2010
1635
+ // http://baagoe.com/en/RandomMusings/javascript/
1636
+ // https://github.com/nquinlan/better-random-numbers-for-javascript-mirror
1637
+ // Original work is under MIT license -
1638
+
1639
+ // Copyright (C) 2010 by Johannes Baagøe <baagoe@baagoe.org>
1640
+ //
1641
+ // Permission is hereby granted, free of charge, to any person obtaining a copy
1642
+ // of this software and associated documentation files (the "Software"), to deal
1643
+ // in the Software without restriction, including without limitation the rights
1644
+ // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
1645
+ // copies of the Software, and to permit persons to whom the Software is
1646
+ // furnished to do so, subject to the following conditions:
1647
+ //
1648
+ // The above copyright notice and this permission notice shall be included in
1649
+ // all copies or substantial portions of the Software.
1650
+ //
1651
+ // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
1652
+ // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
1653
+ // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
1654
+ // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
1655
+ // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
1656
+ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
1657
+ // THE SOFTWARE.
1658
+
1659
+
1660
+
1661
+ (function(global, module, define) {
1662
+
1663
+ function Alea(seed) {
1664
+ var me = this, mash = Mash();
1665
+
1666
+ me.next = function() {
1667
+ var t = 2091639 * me.s0 + me.c * 2.3283064365386963e-10; // 2^-32
1668
+ me.s0 = me.s1;
1669
+ me.s1 = me.s2;
1670
+ return me.s2 = t - (me.c = t | 0);
1671
+ };
1672
+
1673
+ // Apply the seeding algorithm from Baagoe.
1674
+ me.c = 1;
1675
+ me.s0 = mash(' ');
1676
+ me.s1 = mash(' ');
1677
+ me.s2 = mash(' ');
1678
+ me.s0 -= mash(seed);
1679
+ if (me.s0 < 0) { me.s0 += 1; }
1680
+ me.s1 -= mash(seed);
1681
+ if (me.s1 < 0) { me.s1 += 1; }
1682
+ me.s2 -= mash(seed);
1683
+ if (me.s2 < 0) { me.s2 += 1; }
1684
+ mash = null;
1685
+ }
1694
1686
 
1695
- function impl(seed, opts) {
1696
- var xg = new Alea(seed),
1697
- state = opts && opts.state,
1698
- prng = xg.next;
1699
- prng.int32 = function() { return (xg.next() * 0x100000000) | 0; };
1700
- prng.double = function() {
1701
- return prng() + (prng() * 0x200000 | 0) * 1.1102230246251565e-16; // 2^-53
1702
- };
1703
- prng.quick = prng;
1704
- if (state) {
1705
- if (typeof(state) == 'object') copy(state, xg);
1706
- prng.state = function() { return copy(xg, {}); };
1707
- }
1708
- return prng;
1709
- }
1687
+ function copy(f, t) {
1688
+ t.c = f.c;
1689
+ t.s0 = f.s0;
1690
+ t.s1 = f.s1;
1691
+ t.s2 = f.s2;
1692
+ return t;
1693
+ }
1710
1694
 
1711
- function Mash() {
1712
- var n = 0xefc8249d;
1713
-
1714
- var mash = function(data) {
1715
- data = String(data);
1716
- for (var i = 0; i < data.length; i++) {
1717
- n += data.charCodeAt(i);
1718
- var h = 0.02519603282416938 * n;
1719
- n = h >>> 0;
1720
- h -= n;
1721
- h *= n;
1722
- n = h >>> 0;
1723
- h -= n;
1724
- n += h * 0x100000000; // 2^32
1725
- }
1726
- return (n >>> 0) * 2.3283064365386963e-10; // 2^-32
1727
- };
1695
+ function impl(seed, opts) {
1696
+ var xg = new Alea(seed),
1697
+ state = opts && opts.state,
1698
+ prng = xg.next;
1699
+ prng.int32 = function() { return (xg.next() * 0x100000000) | 0; };
1700
+ prng.double = function() {
1701
+ return prng() + (prng() * 0x200000 | 0) * 1.1102230246251565e-16; // 2^-53
1702
+ };
1703
+ prng.quick = prng;
1704
+ if (state) {
1705
+ if (typeof(state) == 'object') copy(state, xg);
1706
+ prng.state = function() { return copy(xg, {}); };
1707
+ }
1708
+ return prng;
1709
+ }
1728
1710
 
1729
- return mash;
1730
- }
1711
+ function Mash() {
1712
+ var n = 0xefc8249d;
1713
+
1714
+ var mash = function(data) {
1715
+ data = String(data);
1716
+ for (var i = 0; i < data.length; i++) {
1717
+ n += data.charCodeAt(i);
1718
+ var h = 0.02519603282416938 * n;
1719
+ n = h >>> 0;
1720
+ h -= n;
1721
+ h *= n;
1722
+ n = h >>> 0;
1723
+ h -= n;
1724
+ n += h * 0x100000000; // 2^32
1725
+ }
1726
+ return (n >>> 0) * 2.3283064365386963e-10; // 2^-32
1727
+ };
1728
+
1729
+ return mash;
1730
+ }
1731
1731
 
1732
1732
 
1733
- if (module && module.exports) {
1734
- module.exports = impl;
1735
- } else if (define && define.amd) {
1736
- define(function() { return impl; });
1737
- } else {
1738
- this.alea = impl;
1739
- }
1733
+ if (module && module.exports) {
1734
+ module.exports = impl;
1735
+ } else if (define && define.amd) {
1736
+ define(function() { return impl; });
1737
+ } else {
1738
+ this.alea = impl;
1739
+ }
1740
1740
 
1741
- })(
1742
- commonjsGlobal,
1743
- module, // present in node.js
1744
- (typeof undefined) == 'function' // present with an AMD loader
1745
- );
1746
- }(alea));
1741
+ })(
1742
+ commonjsGlobal,
1743
+ module, // present in node.js
1744
+ (typeof undefined) == 'function' // present with an AMD loader
1745
+ );
1746
+ } (alea));
1747
1747
 
1748
1748
  var seedrandom = alea.exports;
1749
1749
 
@@ -2715,7 +2715,7 @@ class JsPsych {
2715
2715
  // write the data from the trial
2716
2716
  this.data.write(data);
2717
2717
  // get back the data with all of the defaults in
2718
- const trial_data = this.data.get().filter({ trial_index: this.global_trial_index });
2718
+ const trial_data = this.data.getLastTrialData();
2719
2719
  // for trial-level callbacks, we just want to pass in a reference to the values
2720
2720
  // of the DataCollection, for easy access and editing.
2721
2721
  const trial_data_values = trial_data.values()[0];