Skip to content

Commit

Permalink
some stylistic changes
Browse files Browse the repository at this point in the history
  • Loading branch information
zloirock committed Sep 14, 2023
1 parent 93eb436 commit c9d9049
Show file tree
Hide file tree
Showing 9 changed files with 19 additions and 19 deletions.
2 changes: 1 addition & 1 deletion packages/core-js/internals/is-constructor.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ var empty = [];
var construct = getBuiltIn('Reflect', 'construct');
var constructorRegExp = /^\s*(?:class|function)\b/;
var exec = uncurryThis(constructorRegExp.exec);
var INCORRECT_TO_STRING = !constructorRegExp.exec(noop);
var INCORRECT_TO_STRING = !constructorRegExp.test(noop);

var isConstructorModern = function isConstructor(argument) {
if (!isCallable(argument)) return false;
Expand Down
2 changes: 1 addition & 1 deletion packages/core-js/internals/regexp-unsupported-dot-all.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@ var $RegExp = global.RegExp;

module.exports = fails(function () {
var re = $RegExp('.', 's');
return !(re.dotAll && re.exec('\n') && re.flags === 's');
return !(re.dotAll && re.test('\n') && re.flags === 's');
});
2 changes: 1 addition & 1 deletion tests/helpers/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ for (const name in $TYPED_ARRAYS) TYPED_ARRAYS.push({
$: Number,
});

export const TYPED_ARRAYS_WITH_BIG_INT = TYPED_ARRAYS.slice();
export const TYPED_ARRAYS_WITH_BIG_INT = [...TYPED_ARRAYS];

for (const name of ['BigInt64Array', 'BigUint64Array']) if (GLOBAL[name]) TYPED_ARRAYS_WITH_BIG_INT.push({
name,
Expand Down
6 changes: 3 additions & 3 deletions tests/unit-global/es.typed.conversions.int16.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ if (DESCRIPTORS) QUnit.test('Int16 conversions', assert => {
return it === 0 && 1 / it === -Infinity ? '-0' : it;
}

let data = [
const data = [
[0, 0, [0, 0]],
[-0, 0, [0, 0]],
[1, 1, [1, 0]],
Expand Down Expand Up @@ -56,7 +56,7 @@ if (DESCRIPTORS) QUnit.test('Int16 conversions', assert => {
];
// Android 4.3- bug
if (NATIVE || !/Android [2-4]/.test(GLOBAL.navigator && navigator.userAgent)) {
data = data.concat([
data.push(
[2147483649, 1, [1, 0]],
[-2147483649, -1, [255, 255]],
[4294967295, -1, [255, 255]],
Expand All @@ -65,7 +65,7 @@ if (DESCRIPTORS) QUnit.test('Int16 conversions', assert => {
[-9007199254740991, 1, [1, 0]],
[9007199254740994, 2, [2, 0]],
[-9007199254740994, -2, [254, 255]],
]);
);
}
for (const [value, conversion, little] of data) {
const big = little.slice().reverse();
Expand Down
6 changes: 3 additions & 3 deletions tests/unit-global/es.typed.conversions.int8.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ if (DESCRIPTORS) QUnit.test('Int8 conversions', assert => {
return it === 0 && 1 / it === -Infinity ? '-0' : it;
}

let data = [
const data = [
[0, 0, [0]],
[-0, 0, [0]],
[1, 1, [1]],
Expand Down Expand Up @@ -56,7 +56,7 @@ if (DESCRIPTORS) QUnit.test('Int8 conversions', assert => {
];
// Android 4.3- bug
if (NATIVE || !/Android [2-4]/.test(GLOBAL.navigator && navigator.userAgent)) {
data = data.concat([
data.push(
[2147483649, 1, [1]],
[-2147483649, -1, [255]],
[4294967295, -1, [255]],
Expand All @@ -65,7 +65,7 @@ if (DESCRIPTORS) QUnit.test('Int8 conversions', assert => {
[-9007199254740991, 1, [1]],
[9007199254740994, 2, [2]],
[-9007199254740994, -2, [254]],
]);
);
}
for (const [value, conversion, little] of data) {
const big = little.slice().reverse();
Expand Down
6 changes: 3 additions & 3 deletions tests/unit-global/es.typed.conversions.uint16.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ if (DESCRIPTORS) QUnit.test('Uint16 conversions', assert => {
return it === 0 && 1 / it === -Infinity ? '-0' : it;
}

let data = [
const data = [
[0, 0, [0, 0]],
[-0, 0, [0, 0]],
[1, 1, [1, 0]],
Expand Down Expand Up @@ -56,7 +56,7 @@ if (DESCRIPTORS) QUnit.test('Uint16 conversions', assert => {
];
// Android 4.3- bug
if (NATIVE || !/Android [2-4]/.test(GLOBAL.navigator && navigator.userAgent)) {
data = data.concat([
data.push(
[2147483649, 1, [1, 0]],
[-2147483649, 65535, [255, 255]],
[4294967295, 65535, [255, 255]],
Expand All @@ -65,7 +65,7 @@ if (DESCRIPTORS) QUnit.test('Uint16 conversions', assert => {
[-9007199254740991, 1, [1, 0]],
[9007199254740994, 2, [2, 0]],
[-9007199254740994, 65534, [254, 255]],
]);
);
}
for (const [value, conversion, little] of data) {
const big = little.slice().reverse();
Expand Down
6 changes: 3 additions & 3 deletions tests/unit-global/es.typed.conversions.uint8.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ if (DESCRIPTORS) QUnit.test('Uint8 conversions', assert => {
return it === 0 && 1 / it === -Infinity ? '-0' : it;
}

let data = [
const data = [
[0, 0, [0]],
[-0, 0, [0]],
[1, 1, [1]],
Expand Down Expand Up @@ -54,7 +54,7 @@ if (DESCRIPTORS) QUnit.test('Uint8 conversions', assert => {
];
// Android 4.3- bug
if (NATIVE || !/Android [2-4]/.test(GLOBAL.navigator && navigator.userAgent)) {
data = data.concat([
data.push(
[2147483649, 1, [1]],
[-2147483649, 255, [255]],
[4294967295, 255, [255]],
Expand All @@ -63,7 +63,7 @@ if (DESCRIPTORS) QUnit.test('Uint8 conversions', assert => {
[-9007199254740991, 1, [1]],
[9007199254740994, 2, [2]],
[-9007199254740994, 254, [254]],
]);
);
}
for (const [value, conversion, little] of data) {
uint8array[0] = value;
Expand Down
4 changes: 2 additions & 2 deletions tests/unit-global/web.structured-clone.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ QUnit.module('structuredClone', () => {
];

QUnit.test('primitives', assert => {
const primitives = [undefined, null].concat(booleans, numbers, bigints, strings);
const primitives = [undefined, null, ...booleans, ...numbers, ...bigints, ...strings];

for (const value of primitives) cloneTest(value, (orig, clone) => {
assert.same(orig, clone, 'primitives should be same after cloned');
Expand All @@ -80,7 +80,7 @@ QUnit.module('structuredClone', () => {

// "Primitive" Objects (Boolean, Number, BigInt, String)
QUnit.test('primitive objects', assert => {
const primitives = [].concat(booleans, numbers, bigints, strings);
const primitives = [...booleans, ...numbers, ...bigints, ...strings];

for (const value of primitives) cloneObjectTest(assert, Object(value), (orig, clone) => {
assert.same(orig.valueOf(), clone.valueOf(), 'primitive wrappers should have same value');
Expand Down
4 changes: 2 additions & 2 deletions tests/unit-pure/web.structured-clone.js
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ QUnit.module('structuredClone', () => {
];

QUnit.test('primitives', assert => {
const primitives = [undefined, null].concat(booleans, numbers, bigints, strings);
const primitives = [undefined, null, ...booleans, ...numbers, ...bigints, ...strings];

for (const value of primitives) cloneTest(value, (orig, clone) => {
assert.same(orig, clone, 'primitives should be same after cloned');
Expand All @@ -88,7 +88,7 @@ QUnit.module('structuredClone', () => {

// "Primitive" Objects (Boolean, Number, BigInt, String)
QUnit.test('primitive objects', assert => {
const primitives = [].concat(booleans, numbers, bigints, strings);
const primitives = [...booleans, ...numbers, ...bigints, ...strings];

for (const value of primitives) cloneObjectTest(assert, Object(value), (orig, clone) => {
assert.same(orig.valueOf(), clone.valueOf(), 'primitive wrappers should have same value');
Expand Down

0 comments on commit c9d9049

Please sign in to comment.