Skip to content

Commit d86daaa

Browse files
committed
review eslint config: enforce new with error constructors
1 parent c9d9049 commit d86daaa

File tree

105 files changed

+211
-200
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

105 files changed

+211
-200
lines changed

packages/core-js-builder/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ module.exports = async function ({
3333
filename = null,
3434
summary = {},
3535
} = {}) {
36-
if (!['bundle', 'cjs', 'esm'].includes(format)) throw TypeError('Incorrect output type');
36+
if (!['bundle', 'cjs', 'esm'].includes(format)) throw new TypeError('Incorrect output type');
3737
summary = { comment: normalizeSummary(summary.comment), console: normalizeSummary(summary.console) };
3838

3939
const TITLE = filename !== null || filename !== undefined ? filename : '`core-js`';

packages/core-js-compat/compat.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ const allModules = require('./modules');
77
const targetsParser = require('./targets-parser');
88

99
function throwInvalidFilter(filter) {
10-
throw TypeError(`Specified invalid module name or pattern: ${ filter }`);
10+
throw new TypeError(`Specified invalid module name or pattern: ${ filter }`);
1111
}
1212

1313
function atLeastSomeModules(modules, filter) {

packages/core-js-compat/get-modules-list-for-target-version.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ const modules = require('./modules');
66
module.exports = function (raw) {
77
const corejs = semver(raw);
88
if (corejs.major !== 3) {
9-
throw RangeError('This version of `core-js-compat` works only with `core-js@3`.');
9+
throw new RangeError('This version of `core-js-compat` works only with `core-js@3`.');
1010
}
1111
const result = [];
1212
for (const version of Object.keys(modulesByVersions)) {

packages/core-js-compat/helpers.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ function semver(input) {
77
// eslint-disable-next-line new-cap -- ok
88
if (!(this instanceof semver)) return new semver(input);
99
const match = /(\d+)(?:\.(\d+))?(?:\.(\d+))?/.exec(input);
10-
if (!match) throw TypeError(`Invalid version: ${ input }`);
10+
if (!match) throw new TypeError(`Invalid version: ${ input }`);
1111
const [, $major, $minor, $patch] = match;
1212
this.major = +$major;
1313
this.minor = $minor ? +$minor : 0;
Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
'use strict';
22
var tryToString = require('../internals/try-to-string');
33

4+
var $TypeError = TypeError;
5+
46
// Perform ? RequireInternalSlot(M, [[MapData]])
57
module.exports = function (it) {
68
if (typeof it == 'object' && 'size' in it && 'has' in it && 'get' in it && 'set' in it && 'delete' in it && 'entries' in it) return it;
7-
throw TypeError(tryToString(it) + ' is not a map');
9+
throw new $TypeError(tryToString(it) + ' is not a map');
810
};
Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
'use strict';
22
var tryToString = require('../internals/try-to-string');
33

4+
var $TypeError = TypeError;
5+
46
// Perform ? RequireInternalSlot(M, [[SetData]])
57
module.exports = function (it) {
68
if (typeof it == 'object' && 'size' in it && 'has' in it && 'add' in it && 'delete' in it && 'keys' in it) return it;
7-
throw TypeError(tryToString(it) + ' is not a set');
9+
throw new $TypeError(tryToString(it) + ' is not a set');
810
};
Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
'use strict';
22
var tryToString = require('../internals/try-to-string');
33

4+
var $TypeError = TypeError;
5+
46
// Perform ? RequireInternalSlot(M, [[WeakMapData]])
57
module.exports = function (it) {
68
if (typeof it == 'object' && 'has' in it && 'get' in it && 'set' in it && 'delete') return it;
7-
throw TypeError(tryToString(it) + ' is not a weakmap');
9+
throw new $TypeError(tryToString(it) + ' is not a weakmap');
810
};
Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
'use strict';
22
var tryToString = require('../internals/try-to-string');
33

4+
var $TypeError = TypeError;
5+
46
// Perform ? RequireInternalSlot(M, [[WeakSetData]])
57
module.exports = function (it) {
68
if (typeof it == 'object' && 'has' in it && 'add' in it && 'delete' in it) return it;
7-
throw TypeError(tryToString(it) + ' is not a weakset');
9+
throw new $TypeError(tryToString(it) + ' is not a weakset');
810
};

packages/core-js/internals/a-callable.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,5 @@ var $TypeError = TypeError;
77
// `Assert: IsCallable(argument) is true`
88
module.exports = function (argument) {
99
if (isCallable(argument)) return argument;
10-
throw $TypeError(tryToString(argument) + ' is not a function');
10+
throw new $TypeError(tryToString(argument) + ' is not a function');
1111
};

packages/core-js/internals/a-constructor.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,5 @@ var $TypeError = TypeError;
77
// `Assert: IsConstructor(argument) is true`
88
module.exports = function (argument) {
99
if (isConstructor(argument)) return argument;
10-
throw $TypeError(tryToString(argument) + ' is not a constructor');
10+
throw new $TypeError(tryToString(argument) + ' is not a constructor');
1111
};

packages/core-js/internals/a-possible-prototype.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,5 @@ var $TypeError = TypeError;
66

77
module.exports = function (argument) {
88
if (typeof argument == 'object' || isCallable(argument)) return argument;
9-
throw $TypeError("Can't set " + $String(argument) + ' as a prototype');
9+
throw new $TypeError("Can't set " + $String(argument) + ' as a prototype');
1010
};

packages/core-js/internals/an-instance.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,5 @@ var $TypeError = TypeError;
55

66
module.exports = function (it, Prototype) {
77
if (isPrototypeOf(Prototype, it)) return it;
8-
throw $TypeError('Incorrect invocation');
8+
throw new $TypeError('Incorrect invocation');
99
};

packages/core-js/internals/an-object.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,5 @@ var $TypeError = TypeError;
77
// `Assert: Type(argument) is Object`
88
module.exports = function (argument) {
99
if (isObject(argument)) return argument;
10-
throw $TypeError($String(argument) + ' is not an object');
10+
throw new $TypeError($String(argument) + ' is not an object');
1111
};

packages/core-js/internals/array-buffer-byte-length.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,6 @@ var $TypeError = TypeError;
88
// - Perform ? RequireInternalSlot(O, [[ArrayBufferData]]).
99
// - If IsSharedArrayBuffer(O) is true, throw a TypeError exception.
1010
module.exports = uncurryThisAccessor(ArrayBuffer.prototype, 'byteLength', 'get') || function (O) {
11-
if (classof(O) !== 'ArrayBuffer') throw $TypeError('ArrayBuffer expected');
11+
if (classof(O) !== 'ArrayBuffer') throw new $TypeError('ArrayBuffer expected');
1212
return O.byteLength;
1313
};

packages/core-js/internals/array-buffer-transfer.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ module.exports = PROPER_TRANSFER && function (arrayBuffer, newLength, preserveRe
2424
var byteLength = arrayBufferByteLength(arrayBuffer);
2525
var newByteLength = newLength === undefined ? byteLength : toIndex(newLength);
2626
var fixedLength = !isResizable || !isResizable(arrayBuffer);
27-
if (isDetached(arrayBuffer)) throw TypeError('ArrayBuffer is detached');
27+
if (isDetached(arrayBuffer)) throw new TypeError('ArrayBuffer is detached');
2828
var newBuffer = structuredClone(arrayBuffer, { transfer: [arrayBuffer] });
2929
if (byteLength === newByteLength && (preserveResizability || fixedLength)) return newBuffer;
3030
if (byteLength >= newByteLength && (!preserveResizability || fixedLength)) return slice(newBuffer, 0, newByteLength);

packages/core-js/internals/array-buffer-view-core.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -77,12 +77,12 @@ var isTypedArray = function (it) {
7777

7878
var aTypedArray = function (it) {
7979
if (isTypedArray(it)) return it;
80-
throw TypeError('Target is not a typed array');
80+
throw new TypeError('Target is not a typed array');
8181
};
8282

8383
var aTypedArrayConstructor = function (C) {
8484
if (isCallable(C) && (!setPrototypeOf || isPrototypeOf(TypedArray, C))) return C;
85-
throw TypeError(tryToString(C) + ' is not a typed array constructor');
85+
throw new TypeError(tryToString(C) + ' is not a typed array constructor');
8686
};
8787

8888
var exportTypedArrayMethod = function (KEY, property, forced, options) {
@@ -146,7 +146,7 @@ for (NAME in BigIntArrayConstructorsList) {
146146
if (!NATIVE_ARRAY_BUFFER_VIEWS || !isCallable(TypedArray) || TypedArray === Function.prototype) {
147147
// eslint-disable-next-line no-shadow -- safe
148148
TypedArray = function TypedArray() {
149-
throw TypeError('Incorrect invocation');
149+
throw new TypeError('Incorrect invocation');
150150
};
151151
if (NATIVE_ARRAY_BUFFER_VIEWS) for (NAME in TypedArrayConstructorsList) {
152152
if (global[NAME]) setPrototypeOf(global[NAME], TypedArray);

packages/core-js/internals/array-buffer.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ var get = function (view, count, index, isLittleEndian) {
8282
var store = getInternalDataViewState(view);
8383
var intIndex = toIndex(index);
8484
var boolIsLittleEndian = !!isLittleEndian;
85-
if (intIndex + count > store.byteLength) throw RangeError(WRONG_INDEX);
85+
if (intIndex + count > store.byteLength) throw new RangeError(WRONG_INDEX);
8686
var bytes = store.bytes;
8787
var start = intIndex + store.byteOffset;
8888
var pack = arraySlice(bytes, start, start + count);
@@ -94,7 +94,7 @@ var set = function (view, count, index, conversion, value, isLittleEndian) {
9494
var intIndex = toIndex(index);
9595
var pack = conversion(+value);
9696
var boolIsLittleEndian = !!isLittleEndian;
97-
if (intIndex + count > store.byteLength) throw RangeError(WRONG_INDEX);
97+
if (intIndex + count > store.byteLength) throw new RangeError(WRONG_INDEX);
9898
var bytes = store.bytes;
9999
var start = intIndex + store.byteOffset;
100100
for (var i = 0; i < count; i++) bytes[start + i] = pack[boolIsLittleEndian ? i : count - i - 1];
@@ -123,9 +123,9 @@ if (!NATIVE_ARRAY_BUFFER) {
123123
var bufferState = getInternalArrayBufferState(buffer);
124124
var bufferLength = bufferState.byteLength;
125125
var offset = toIntegerOrInfinity(byteOffset);
126-
if (offset < 0 || offset > bufferLength) throw RangeError('Wrong offset');
126+
if (offset < 0 || offset > bufferLength) throw new RangeError('Wrong offset');
127127
byteLength = byteLength === undefined ? bufferLength - offset : toLength(byteLength);
128-
if (offset + byteLength > bufferLength) throw RangeError(WRONG_LENGTH);
128+
if (offset + byteLength > bufferLength) throw new RangeError(WRONG_LENGTH);
129129
setInternalState(this, {
130130
type: DATA_VIEW,
131131
buffer: buffer,

packages/core-js/internals/array-reduce.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ var createMethod = function (IS_RIGHT) {
2323
}
2424
index += i;
2525
if (IS_RIGHT ? index < 0 : length <= index) {
26-
throw $TypeError('Reduce of empty array with no initial value');
26+
throw new $TypeError('Reduce of empty array with no initial value');
2727
}
2828
}
2929
for (;IS_RIGHT ? index >= 0 : length > index; index += i) if (index in self) {

packages/core-js/internals/array-set-length.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ var SILENT_ON_NON_WRITABLE_LENGTH_SET = DESCRIPTORS && !function () {
2020

2121
module.exports = SILENT_ON_NON_WRITABLE_LENGTH_SET ? function (O, length) {
2222
if (isArray(O) && !getOwnPropertyDescriptor(O, 'length').writable) {
23-
throw $TypeError('Cannot set read only .length');
23+
throw new $TypeError('Cannot set read only .length');
2424
} return O.length = length;
2525
} : function (O, length) {
2626
return O.length = length;

packages/core-js/internals/array-with.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ module.exports = function (O, C, index, value) {
1010
var len = lengthOfArrayLike(O);
1111
var relativeIndex = toIntegerOrInfinity(index);
1212
var actualIndex = relativeIndex < 0 ? len + relativeIndex : relativeIndex;
13-
if (actualIndex >= len || actualIndex < 0) throw $RangeError('Incorrect index');
13+
if (actualIndex >= len || actualIndex < 0) throw new $RangeError('Incorrect index');
1414
var A = new C(len);
1515
var k = 0;
1616
for (; k < len; k++) A[k] = k === actualIndex ? value : O[k];

packages/core-js/internals/composite-key.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ module.exports = function () {
4343
for (i = 0; i < length; i++) {
4444
if (isObject(it = arguments[i])) active = active.next(i, it, true);
4545
}
46-
if (this === $Object && active === root) throw $TypeError('Composite keys must contain a non-primitive component');
46+
if (this === $Object && active === root) throw new $TypeError('Composite keys must contain a non-primitive component');
4747
for (i = 0; i < length; i++) {
4848
if (!isObject(it = arguments[i])) active = active.next(i, it, false);
4949
} return active;

packages/core-js/internals/date-to-iso-string.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ module.exports = (fails(function () {
2525
}) || !fails(function () {
2626
nativeDateToISOString.call(new Date(NaN));
2727
})) ? function toISOString() {
28-
if (!$isFinite(thisTimeValue(this))) throw $RangeError('Invalid time value');
28+
if (!$isFinite(thisTimeValue(this))) throw new $RangeError('Invalid time value');
2929
var date = this;
3030
var year = getUTCFullYear(date);
3131
var milliseconds = getUTCMilliseconds(date);

packages/core-js/internals/date-to-primitive.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,6 @@ var $TypeError = TypeError;
99
module.exports = function (hint) {
1010
anObject(this);
1111
if (hint === 'string' || hint === 'default') hint = 'string';
12-
else if (hint !== 'number') throw $TypeError('Incorrect hint');
12+
else if (hint !== 'number') throw new $TypeError('Incorrect hint');
1313
return ordinaryToPrimitive(this, hint);
1414
};

packages/core-js/internals/delete-property-or-throw.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,5 @@ var tryToString = require('../internals/try-to-string');
44
var $TypeError = TypeError;
55

66
module.exports = function (O, P) {
7-
if (!delete O[P]) throw $TypeError('Cannot delete property ' + tryToString(P) + ' of ' + tryToString(O));
7+
if (!delete O[P]) throw new $TypeError('Cannot delete property ' + tryToString(P) + ' of ' + tryToString(O));
88
};

packages/core-js/internals/error-stack-clear.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ var uncurryThis = require('../internals/function-uncurry-this');
44
var $Error = Error;
55
var replace = uncurryThis(''.replace);
66

7-
var TEST = (function (arg) { return String($Error(arg).stack); })('zxcasd');
7+
var TEST = (function (arg) { return String(new $Error(arg).stack); })('zxcasd');
88
// eslint-disable-next-line redos/no-vulnerable -- safe
99
var V8_OR_CHAKRA_STACK_ENTRY = /\n\s*at [^:]*:[^\n]*/;
1010
var IS_V8_OR_CHAKRA_STACK = V8_OR_CHAKRA_STACK_ENTRY.test(TEST);

packages/core-js/internals/error-stack-installable.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ var fails = require('../internals/fails');
33
var createPropertyDescriptor = require('../internals/create-property-descriptor');
44

55
module.exports = !fails(function () {
6-
var error = Error('a');
6+
var error = new Error('a');
77
if (!('stack' in error)) return true;
88
// eslint-disable-next-line es/no-object-defineproperty -- safe
99
Object.defineProperty(error, 'stack', createPropertyDescriptor(1, 7));

packages/core-js/internals/get-iterator.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,5 @@ var $TypeError = TypeError;
1010
module.exports = function (argument, usingIterator) {
1111
var iteratorMethod = arguments.length < 2 ? getIteratorMethod(argument) : usingIterator;
1212
if (aCallable(iteratorMethod)) return anObject(call(iteratorMethod, argument));
13-
throw $TypeError(tryToString(argument) + ' is not iterable');
13+
throw new $TypeError(tryToString(argument) + ' is not iterable');
1414
};

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,9 @@ module.exports = function (obj) {
3333
var numSize = +obj.size;
3434
// NOTE: If size is undefined, then numSize will be NaN
3535
// eslint-disable-next-line no-self-compare -- NaN check
36-
if (numSize !== numSize) throw $TypeError(INVALID_SIZE);
36+
if (numSize !== numSize) throw new $TypeError(INVALID_SIZE);
3737
var intSize = toIntegerOrInfinity(numSize);
38-
if (intSize < 0) throw $RangeError(INVALID_SIZE);
38+
if (intSize < 0) throw new $RangeError(INVALID_SIZE);
3939
return new SetRecord(
4040
obj,
4141
max(intSize, 0),

packages/core-js/internals/internal-state.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ var getterFor = function (TYPE) {
2121
return function (it) {
2222
var state;
2323
if (!isObject(it) || (state = get(it)).type !== TYPE) {
24-
throw TypeError('Incompatible receiver, ' + TYPE + ' required');
24+
throw new TypeError('Incompatible receiver, ' + TYPE + ' required');
2525
} return state;
2626
};
2727
};
@@ -34,7 +34,7 @@ if (NATIVE_WEAK_MAP || shared.state) {
3434
store.set = store.set;
3535
/* eslint-enable no-self-assign -- prototype methods protection */
3636
set = function (it, metadata) {
37-
if (store.has(it)) throw TypeError(OBJECT_ALREADY_INITIALIZED);
37+
if (store.has(it)) throw new TypeError(OBJECT_ALREADY_INITIALIZED);
3838
metadata.facade = it;
3939
store.set(it, metadata);
4040
return metadata;
@@ -49,7 +49,7 @@ if (NATIVE_WEAK_MAP || shared.state) {
4949
var STATE = sharedKey('state');
5050
hiddenKeys[STATE] = true;
5151
set = function (it, metadata) {
52-
if (hasOwn(it, STATE)) throw TypeError(OBJECT_ALREADY_INITIALIZED);
52+
if (hasOwn(it, STATE)) throw new TypeError(OBJECT_ALREADY_INITIALIZED);
5353
metadata.facade = it;
5454
createNonEnumerableProperty(it, STATE, metadata);
5555
return metadata;

packages/core-js/internals/iterate.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ module.exports = function (iterable, unboundFunction, options) {
4646
iterator = iterable;
4747
} else {
4848
iterFn = getIteratorMethod(iterable);
49-
if (!iterFn) throw $TypeError(tryToString(iterable) + ' is not iterable');
49+
if (!iterFn) throw new $TypeError(tryToString(iterable) + ' is not iterable');
5050
// optimisation for array iterators
5151
if (isArrayIteratorMethod(iterFn)) {
5252
for (index = 0, length = lengthOfArrayLike(iterable); length > index; index++) {

packages/core-js/internals/map-upsert.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ module.exports = function upsert(key, updateFn /* , insertFn */) {
1616
var insertFn = arguments.length > 2 ? arguments[2] : undefined;
1717
var value;
1818
if (!isCallable(updateFn) && !isCallable(insertFn)) {
19-
throw $TypeError('At least one callback required');
19+
throw new $TypeError('At least one callback required');
2020
}
2121
if (call(has, map, key)) {
2222
value = call(get, map, key);

packages/core-js/internals/new-promise-capability.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ var $TypeError = TypeError;
66
var PromiseCapability = function (C) {
77
var resolve, reject;
88
this.promise = new C(function ($$resolve, $$reject) {
9-
if (resolve !== undefined || reject !== undefined) throw $TypeError('Bad Promise constructor');
9+
if (resolve !== undefined || reject !== undefined) throw new $TypeError('Bad Promise constructor');
1010
resolve = $$resolve;
1111
reject = $$reject;
1212
});

packages/core-js/internals/not-a-nan.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,5 @@ var $RangeError = RangeError;
44
module.exports = function (it) {
55
// eslint-disable-next-line no-self-compare -- NaN check
66
if (it === it) return it;
7-
throw $RangeError('NaN is not allowed');
7+
throw new $RangeError('NaN is not allowed');
88
};

packages/core-js/internals/not-a-regexp.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,6 @@ var $TypeError = TypeError;
55

66
module.exports = function (it) {
77
if (isRegExp(it)) {
8-
throw $TypeError("The method doesn't accept regular expressions");
8+
throw new $TypeError("The method doesn't accept regular expressions");
99
} return it;
1010
};

packages/core-js/internals/numeric-range-iterator.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,10 @@ var $TypeError = TypeError;
1919
var $RangeIterator = createIteratorConstructor(function NumericRangeIterator(start, end, option, type, zero, one) {
2020
// TODO: Drop the first `typeof` check after removing legacy methods in `core-js@4`
2121
if (typeof start != type || (end !== Infinity && end !== -Infinity && typeof end != type)) {
22-
throw $TypeError(INCORRECT_RANGE);
22+
throw new $TypeError(INCORRECT_RANGE);
2323
}
2424
if (start === Infinity || start === -Infinity) {
25-
throw $RangeError(INCORRECT_RANGE);
25+
throw new $RangeError(INCORRECT_RANGE);
2626
}
2727
var ifIncrease = end > start;
2828
var inclusiveEnd = false;
@@ -35,16 +35,16 @@ var $RangeIterator = createIteratorConstructor(function NumericRangeIterator(sta
3535
} else if (typeof option == type) {
3636
step = option;
3737
} else {
38-
throw $TypeError(INCORRECT_RANGE);
38+
throw new $TypeError(INCORRECT_RANGE);
3939
}
4040
if (isNullOrUndefined(step)) {
4141
step = ifIncrease ? one : -one;
4242
}
4343
if (typeof step != type) {
44-
throw $TypeError(INCORRECT_RANGE);
44+
throw new $TypeError(INCORRECT_RANGE);
4545
}
4646
if (step === Infinity || step === -Infinity || (step === zero && start !== end)) {
47-
throw $RangeError(INCORRECT_RANGE);
47+
throw new $RangeError(INCORRECT_RANGE);
4848
}
4949
// eslint-disable-next-line no-self-compare -- NaN check
5050
var hitsEnd = start !== start || end !== end || step !== step || (end > start) !== (step > zero);

packages/core-js/internals/object-define-property.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ exports.f = DESCRIPTORS ? V8_PROTOTYPE_DEFINE_BUG ? function defineProperty(O, P
3838
if (IE8_DOM_DEFINE) try {
3939
return $defineProperty(O, P, Attributes);
4040
} catch (error) { /* empty */ }
41-
if ('get' in Attributes || 'set' in Attributes) throw $TypeError('Accessors not supported');
41+
if ('get' in Attributes || 'set' in Attributes) throw new $TypeError('Accessors not supported');
4242
if ('value' in Attributes) O[P] = Attributes.value;
4343
return O;
4444
};

0 commit comments

Comments
 (0)