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