Skip to content

Commit

Permalink
Updated 'keys' and 'values' prototype not to wrap elements in own array
Browse files Browse the repository at this point in the history
  • Loading branch information
rtkmrussell committed May 3, 2018
1 parent 32f3519 commit 359fa90
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
4 changes: 2 additions & 2 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@
USPProto.keys = USPProto.keys || function() {
var items = [];
this.forEach(function(item, name) {
items.push([name]);
items.push(name);
});
return makeIterator(items);
};
Expand All @@ -197,7 +197,7 @@
USPProto.values = USPProto.values || function() {
var items = [];
this.forEach(function(item) {
items.push([item]);
items.push(item);
});
return makeIterator(items);
};
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "url-search-params-polyfill",
"version": "3.0.0",
"version": "4.0.0",
"description": "a simple polyfill for javascript URLSearchParams",
"homepage": "https://github.com/jerrybendy/url-search-params-polyfill",
"main": "index.js",
Expand Down
4 changes: 4 additions & 0 deletions test/index.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,8 @@ describe(PREFIX + 'Iterator', function () {
ret.push(key);
}
expect(ret.join(';')).to.be.equal('a;b;c');

expect(Array.from(obj.keys())).to.be.eql(['a','b','c']);
});

it('values', function () {
Expand All @@ -237,6 +239,8 @@ describe(PREFIX + 'Iterator', function () {
ret.push(value);
}
expect(ret.join(';')).to.be.equal('1;2;3');

expect(Array.from(obj.values())).to.be.eql(['1', '2', '3']);
});

});
Expand Down

0 comments on commit 359fa90

Please sign in to comment.