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