Sha256: aef41df5b8a691c3a671fcb469d2dd266ca880c43ef43100aab0ed18d7369f15

Contents?: true

Size: 917 Bytes

Versions: 5

Compression:

Stored size: 917 Bytes

Contents

(function(env) {
  function hasFunctioningMaps() {
    if (typeof Map === 'undefined') { return false; }

    try {
      var s = new Map();
      s.set('a',1);
      s.set('b',2);

      if (s.size !== 2) { return false; }
      if (s.has('a') !== true) { return false; }

      var iterations = 0;
      var ifForEachWorking = true;
      s.forEach(function(value, key, map) {
        ifForEachWorking = ifForEachWorking && map === s;
        if (key==='a') {
          ifForEachWorking = ifForEachWorking && value===1;
        }
        iterations++;
      });
      if (iterations !== 2) { return false; }
      if (ifForEachWorking !== true) { return false; }

      return true;
    } catch(e) {
      return false;
    }
  }

  env.requireFunctioningMaps = function() {
    if (!hasFunctioningMaps()) {
      env.pending("Browser has incomplete or missing support for Maps");
    }
  };

})(jasmine.getEnv());

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
jasmine-core-2.99.1 ./lib/jasmine-core/spec/helpers/checkForMap.js
jasmine-core-3.0.0 ./lib/jasmine-core/spec/helpers/checkForMap.js
jasmine-core-2.99.0 ./lib/jasmine-core/spec/helpers/checkForMap.js
jasmine-core-2.9.1 ./lib/jasmine-core/spec/helpers/checkForMap.js
jasmine-core-2.9.0 ./lib/jasmine-core/spec/helpers/checkForMap.js