Skip to content

Commit

Permalink
[Refactor] use math-intrinsics
Browse files Browse the repository at this point in the history
  • Loading branch information
ljharb committed Dec 11, 2024
1 parent 45de9aa commit cefba0d
Show file tree
Hide file tree
Showing 441 changed files with 680 additions and 884 deletions.
4 changes: 2 additions & 2 deletions 2015/AbstractRelationalComparison.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 3 additions & 2 deletions 2015/AdvanceStringIndex.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
'use strict';

var isInteger = require('../helpers/isInteger');
var isInteger = require('math-intrinsics/isInteger');
var MAX_SAFE_INTEGER = require('math-intrinsics/constants/maxSafeInteger');

var isLeadingSurrogate = require('../helpers/isLeadingSurrogate');
var isTrailingSurrogate = require('../helpers/isTrailingSurrogate');
var MAX_SAFE_INTEGER = require('../helpers/maxSafeInteger');

var $TypeError = require('es-errors/type');

Expand Down
6 changes: 2 additions & 4 deletions 2015/ArrayCreate.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,11 @@ var $ArrayPrototype = GetIntrinsic('%Array.prototype%');
var $RangeError = require('es-errors/range');
var $SyntaxError = require('es-errors/syntax');
var $TypeError = require('es-errors/type');

var isInteger = require('../helpers/isInteger');
var isInteger = require('math-intrinsics/isInteger');
var MAX_ARRAY_LENGTH = require('math-intrinsics/constants/maxArrayLength');

var hasProto = require('has-proto')();

var MAX_ARRAY_LENGTH = Math.pow(2, 32) - 1;

var $setProto = GetIntrinsic('%Object.setPrototypeOf%', true) || (
hasProto
? function (O, proto) {
Expand Down
2 changes: 1 addition & 1 deletion 2015/ArraySpeciesCreate.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@ var GetIntrinsic = require('get-intrinsic');
var $Array = GetIntrinsic('%Array%');
var $species = GetIntrinsic('%Symbol.species%', true);
var $TypeError = require('es-errors/type');
var isInteger = require('math-intrinsics/isInteger');

var Get = require('./Get');
var IsArray = require('./IsArray');
var IsConstructor = require('./IsConstructor');

var isInteger = require('../helpers/isInteger');
var isObject = require('../helpers/isObject');

// https://262.ecma-international.org/6.0/#sec-arrayspeciescreate
Expand Down
3 changes: 1 addition & 2 deletions 2015/GetSubstitution.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ var $TypeError = require('es-errors/type');
var $parseInt = GetIntrinsic('%parseInt%');

var inspect = require('object-inspect');

var isInteger = require('math-intrinsics/isInteger');
var regexTester = require('safe-regex-test');
var callBound = require('call-bound');
var every = require('../helpers/every');
Expand All @@ -19,7 +19,6 @@ var $strSlice = callBound('String.prototype.slice');

var IsArray = require('./IsArray');

var isInteger = require('../helpers/isInteger');
var isStringOrUndefined = require('../helpers/isStringOrUndefined');

// https://262.ecma-international.org/6.0/#sec-getsubstitution
Expand Down
2 changes: 1 addition & 1 deletion 2015/GetValueFromBuffer.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ var GetIntrinsic = require('get-intrinsic');
var $TypeError = require('es-errors/type');
var $Uint8Array = GetIntrinsic('%Uint8Array%', true);

var isInteger = require('math-intrinsics/isInteger');
var callBound = require('call-bound');

var $charAt = callBound('String.prototype.charAt');
Expand All @@ -15,7 +16,6 @@ var bytesAsFloat32 = require('../helpers/bytesAsFloat32');
var bytesAsFloat64 = require('../helpers/bytesAsFloat64');
var bytesAsInteger = require('../helpers/bytesAsInteger');
var defaultEndianness = require('../helpers/defaultEndianness');
var isInteger = require('../helpers/isInteger');

var IsDetachedBuffer = require('./IsDetachedBuffer');

Expand Down
3 changes: 1 addition & 2 deletions 2015/IntegerIndexedElementGet.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,12 @@

var $SyntaxError = require('es-errors/syntax');
var $TypeError = require('es-errors/type');
var isNegativeZero = require('math-intrinsics/isNegativeZero');

var GetValueFromBuffer = require('./GetValueFromBuffer');
var IsDetachedBuffer = require('./IsDetachedBuffer');
var IsInteger = require('./IsInteger');

var isNegativeZero = require('../helpers/isNegativeZero');

var typedArrayLength = require('typed-array-length');
var typedArrayBuffer = require('typed-array-buffer');
var typedArrayByteOffset = require('typed-array-byte-offset');
Expand Down
2 changes: 1 addition & 1 deletion 2015/IntegerIndexedElementSet.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ var IsInteger = require('./IsInteger');
var SetValueInBuffer = require('./SetValueInBuffer');
var ToNumber = require('./ToNumber');

var isNegativeZero = require('is-negative-zero');
var isNegativeZero = require('math-intrinsics/isNegativeZero');
var typedArrayBuffer = require('typed-array-buffer');
var typedArrayByteOffset = require('typed-array-byte-offset');
var typedArrayLength = require('typed-array-length');
Expand Down
2 changes: 1 addition & 1 deletion 2015/IsInteger.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
'use strict';

var isInteger = require('../helpers/isInteger');
var isInteger = require('math-intrinsics/isInteger');

// https://262.ecma-international.org/6.0/#sec-isinteger

Expand Down
3 changes: 2 additions & 1 deletion 2015/MakeDate.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion 2015/MakeDay.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion 2015/MakeTime.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions 2015/ObjectDefineProperties.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,12 @@ var OwnPropertyKeys = require('../helpers/OwnPropertyKeys');
var $push = callBound('Array.prototype.push');

// https://262.ecma-international.org/6.0/#sec-objectdefineproperties

/** @type {<T extends Record<PropertyKey, unknown> = {}>(O: T, Properties: object) => T} */
module.exports = function ObjectDefineProperties(O, Properties) {
var props = ToObject(Properties); // step 1
var keys = OwnPropertyKeys(props); // step 2
/** @type {[string | symbol, import('../types').Descriptor][]} */
var descriptors = []; // step 3

forEach(keys, function (nextKey) { // step 4
Expand Down
2 changes: 1 addition & 1 deletion 2015/SameValue.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion 2015/SameValueZero.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
'use strict';

var $isNaN = require('../helpers/isNaN');
var $isNaN = require('math-intrinsics/isNaN');

// https://262.ecma-international.org/6.0/#sec-samevaluezero

Expand Down
2 changes: 1 addition & 1 deletion 2015/SetValueInBuffer.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ var GetIntrinsic = require('get-intrinsic');
var $TypeError = require('es-errors/type');
var $Uint8Array = GetIntrinsic('%Uint8Array%', true);

var isInteger = require('../helpers/isInteger');
var isInteger = require('math-intrinsics/isInteger');

var IsDetachedBuffer = require('./IsDetachedBuffer');
var ToInt16 = require('./ToInt16');
Expand Down
3 changes: 1 addition & 2 deletions 2015/SplitMatch.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@
var callBound = require('call-bound');

var $TypeError = require('es-errors/type');

var isInteger = require('../helpers/isInteger');
var isInteger = require('math-intrinsics/isInteger');

var $charAt = callBound('String.prototype.charAt');

Expand Down
2 changes: 1 addition & 1 deletion 2015/StringGetIndexProperty.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ var $TypeError = require('es-errors/type');
var $charAt = callBound('String.prototype.charAt');

var isString = require('is-string');
var isNegativeZero = require('is-negative-zero');
var isNegativeZero = require('math-intrinsics/isNegativeZero');
var unbox = require('unbox-primitive');

var CanonicalNumericIndexString = require('./CanonicalNumericIndexString');
Expand Down
4 changes: 2 additions & 2 deletions 2015/TimeClip.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion 2015/ToDateString.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ var $TypeError = require('es-errors/type');
var $Date = GetIntrinsic('%Date%');
var $String = GetIntrinsic('%String%');

var $isNaN = require('../helpers/isNaN');
var $isNaN = require('math-intrinsics/isNaN');

// https://262.ecma-international.org/6.0/#sec-todatestring

Expand Down
2 changes: 1 addition & 1 deletion 2015/ToLength.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
'use strict';

var MAX_SAFE_INTEGER = require('../helpers/maxSafeInteger');
var MAX_SAFE_INTEGER = require('math-intrinsics/constants/maxSafeInteger');

var ToInteger = require('./ToInteger');

Expand Down
10 changes: 5 additions & 5 deletions 2015/ToUint16.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 6 additions & 7 deletions 2015/ToUint8.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,12 @@

var ToNumber = require('./ToNumber');

var $isNaN = require('../helpers/isNaN');
var $isFinite = require('../helpers/isFinite');
var $sign = require('../helpers/sign');

var abs = require('./abs');
var floor = require('./floor');
var modulo = require('./modulo');
var $isNaN = require('math-intrinsics/isNaN');
var $isFinite = require('math-intrinsics/isFinite');
var $sign = require('math-intrinsics/sign');
var abs = require('math-intrinsics/abs');
var floor = require('math-intrinsics/floor');
var modulo = require('math-intrinsics/mod');

// https://262.ecma-international.org/6.0/#sec-touint8

Expand Down
2 changes: 1 addition & 1 deletion 2015/ToUint8Clamp.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
var ToNumber = require('./ToNumber');
var floor = require('./floor');

var $isNaN = require('../helpers/isNaN');
var $isNaN = require('math-intrinsics/isNaN');

// https://262.ecma-international.org/6.0/#sec-touint8clamp

Expand Down
4 changes: 1 addition & 3 deletions 2015/abs.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion 2015/floor.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 1 addition & 3 deletions 2015/max.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
'use strict';

var GetIntrinsic = require('get-intrinsic');

// https://262.ecma-international.org/6.0/#sec-algorithm-conventions

module.exports = GetIntrinsic('%Math.max%');
module.exports = require('math-intrinsics/max');
4 changes: 1 addition & 3 deletions 2015/min.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
'use strict';

var GetIntrinsic = require('get-intrinsic');

// https://262.ecma-international.org/6.0/#sec-algorithm-conventions

module.exports = GetIntrinsic('%Math.min%');
module.exports = require('math-intrinsics/min');
4 changes: 2 additions & 2 deletions 2016/AbstractRelationalComparison.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 3 additions & 2 deletions 2016/AdvanceStringIndex.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 2 additions & 4 deletions 2016/ArrayCreate.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion 2016/ArraySpeciesCreate.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 1 addition & 2 deletions 2016/GetSubstitution.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit cefba0d

Please sign in to comment.