Skip to content

Commit 20ab9c5

Browse files
committedJan 16, 2023
coerce negative set size in get-set-record to 0
1 parent 9f9bc14 commit 20ab9c5

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed
 

‎CHANGELOG.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
## Changelog
22
##### Unreleased
3-
- [`Set` methods proposal](https://github.com/tc39/proposal-set-methods) minor updates:
3+
- [`Set` methods proposal](https://github.com/tc39/proposal-set-methods) updates:
44
- Closing of iterators of `Set`-like objects on early exit, [proposal-set-methods/85](https://github.com/tc39/proposal-set-methods/pull/85)
5+
- Some other minor internal changes
56
- Added one more workaround of a `webpack` dev server bug on IE global methods, [#1161](https://github.com/zloirock/core-js/issues/1161)
67
- Fixed possible `String.{ raw, cooked }` error with empty template array
78
- Used non-standard V8 `Error.captureStackTrace` instead of stack parsing in new error classes / wrappers where it's possible

‎packages/core-js/internals/get-set-record.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ var call = require('../internals/function-call');
44
var toIntegerOrInfinity = require('../internals/to-integer-or-infinity');
55

66
var $TypeError = TypeError;
7+
var max = Math.max;
78

89
var SetRecord = function (set, size, has, keys) {
910
this.set = set;
@@ -31,7 +32,7 @@ module.exports = function (obj) {
3132
if (numSize != numSize) throw $TypeError('Invalid size');
3233
return new SetRecord(
3334
obj,
34-
toIntegerOrInfinity(numSize),
35+
max(toIntegerOrInfinity(numSize), 0),
3536
aCallable(obj.has),
3637
aCallable(obj.keys)
3738
);

0 commit comments

Comments
 (0)
Please sign in to comment.