Skip to content

Commit

Permalink
Updating arity of Map and Set constructors, per 2014.04.27 draft spec…
Browse files Browse the repository at this point in the history
… (rev 24)
  • Loading branch information
ljharb committed Jun 16, 2014
1 parent 441894b commit cad622f
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
6 changes: 2 additions & 4 deletions es6-shim.js
Original file line number Diff line number Diff line change
Expand Up @@ -1523,7 +1523,7 @@
};
addIterator(MapIterator.prototype);

function Map() {
function Map(iterable) {
var map = this;
map = emulateES6construct(map);
if (!map._es6map) {
Expand All @@ -1541,7 +1541,6 @@
});

// Optionally initialize map from iterable
var iterable = arguments[0];
if (iterable !== undefined && iterable !== null) {
var it = ES.GetIterator(iterable);
var adder = map.set;
Expand Down Expand Up @@ -1709,7 +1708,7 @@
// Sets containing only string or numeric keys, we use an object
// as backing storage and lazily create a full Map only when
// required.
var SetShim = function Set() {
var SetShim = function Set(iterable) {
var set = this;
set = emulateES6construct(set);
if (!set._es6set) {
Expand All @@ -1722,7 +1721,6 @@
});

// Optionally initialize map from iterable
var iterable = arguments[0];
if (iterable !== undefined && iterable !== null) {
var it = ES.GetIterator(iterable);
var adder = set.add;
Expand Down
4 changes: 2 additions & 2 deletions test/collections.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ describe('Collections', function() {
});

it('should have the right arity', function() {
expect(Map.length).to.equal(0);
expect(Map.length).to.equal(1);
});

it('should has valid getter and setter calls', function() {
Expand Down Expand Up @@ -422,7 +422,7 @@ describe('Collections', function() {
});

it('should have the right arity', function() {
expect(Set.length).to.equal(0);
expect(Set.length).to.equal(1);
});

it('should accept an iterable as argument', function() {
Expand Down

0 comments on commit cad622f

Please sign in to comment.