Submit
Path:
~
/
/
usr
/
share
/
nodejs
/
es-abstract
/
2015
/
File Content:
ArrayCreate.js
'use strict'; var GetIntrinsic = require('get-intrinsic'); var $ArrayPrototype = GetIntrinsic('%Array.prototype%'); var $RangeError = GetIntrinsic('%RangeError%'); var $SyntaxError = GetIntrinsic('%SyntaxError%'); var $TypeError = GetIntrinsic('%TypeError%'); var IsInteger = require('./IsInteger'); var MAX_ARRAY_LENGTH = Math.pow(2, 32) - 1; var $setProto = GetIntrinsic('%Object.setPrototypeOf%', true) || ( // eslint-disable-next-line no-proto, no-negated-condition [].__proto__ !== $ArrayPrototype ? null : function (O, proto) { O.__proto__ = proto; // eslint-disable-line no-proto, no-param-reassign return O; } ); // https://ecma-international.org/ecma-262/6.0/#sec-arraycreate module.exports = function ArrayCreate(length) { if (!IsInteger(length) || length < 0) { throw new $TypeError('Assertion failed: `length` must be an integer Number >= 0'); } if (length > MAX_ARRAY_LENGTH) { throw new $RangeError('length is greater than (2**32 - 1)'); } var proto = arguments.length > 1 ? arguments[1] : $ArrayPrototype; var A = []; // steps 5 - 7, and 9 if (proto !== $ArrayPrototype) { // step 8 if (!$setProto) { throw new $SyntaxError('ArrayCreate: a `proto` argument that is not `Array.prototype` is not supported in an environment that does not support setting the [[Prototype]]'); } $setProto(A, proto); } if (length !== 0) { // bypasses the need for step 2 A.length = length; } /* step 10, the above as a shortcut for the below OrdinaryDefineOwnProperty(A, 'length', { '[[Configurable]]': false, '[[Enumerable]]': false, '[[Value]]': length, '[[Writable]]': true }); */ return A; };
Submit
FILE
FOLDER
Name
Size
Permission
Action
AbstractEqualityComparison.js
1154 bytes
0644
AbstractRelationalComparison.js
1590 bytes
0644
AdvanceStringIndex.js
1305 bytes
0644
ArrayCreate.js
1683 bytes
0644
ArraySetLength.js
2665 bytes
0644
ArraySpeciesCreate.js
1348 bytes
0644
Call.js
623 bytes
0644
CanonicalNumericIndexString.js
654 bytes
0644
CharacterRange.js
782 bytes
0644
CompletePropertyDescriptor.js
989 bytes
0644
CreateDataProperty.js
1297 bytes
0644
CreateDataPropertyOrThrow.js
734 bytes
0644
CreateHTML.js
927 bytes
0644
CreateIterResultObject.js
432 bytes
0644
CreateListFromArrayLike.js
1354 bytes
0644
CreateMethodProperty.js
979 bytes
0644
DateFromTime.js
1036 bytes
0644
Day.js
234 bytes
0644
DayFromYear.js
256 bytes
0644
DayWithinYear.js
286 bytes
0644
DaysInYear.js
301 bytes
0644
DefinePropertyOrThrow.js
1466 bytes
0644
DeletePropertyOrThrow.js
699 bytes
0644
EnumerableOwnNames.js
417 bytes
0644
FromPropertyDescriptor.js
797 bytes
0644
Get.js
732 bytes
0644
GetIterator.js
872 bytes
0644
GetMethod.js
922 bytes
0644
GetOwnPropertyKeys.js
817 bytes
0644
GetPrototypeFromConstructor.js
921 bytes
0644
GetSubstitution.js
3523 bytes
0644
GetV.js
569 bytes
0644
HasOwnProperty.js
553 bytes
0644
HasProperty.js
517 bytes
0644
HourFromTime.js
382 bytes
0644
InLeapYear.js
510 bytes
0644
InstanceofOperator.js
918 bytes
0644
Invoke.js
715 bytes
0644
IsAccessorDescriptor.js
465 bytes
0644
IsArray.js
410 bytes
0644
IsCallable.js
108 bytes
0644
IsCompatiblePropertyDescriptor.js
367 bytes
0644
IsConcatSpreadable.js
626 bytes
0644
IsConstructor.js
1149 bytes
0644
IsDataDescriptor.js
464 bytes
0644
IsExtensible.js
504 bytes
0644
IsGenericDescriptor.js
560 bytes
0644
IsInteger.js
450 bytes
0644
IsPromise.js
485 bytes
0644
IsPropertyDescriptor.js
554 bytes
0644
IsPropertyKey.js
207 bytes
0644
IsRegExp.js
545 bytes
0644
IteratorClose.js
1481 bytes
0644
IteratorComplete.js
498 bytes
0644
IteratorNext.js
493 bytes
0644
IteratorStep.js
353 bytes
0644
IteratorValue.js
443 bytes
0644
MakeDate.js
328 bytes
0644
MakeDay.js
917 bytes
0644
MakeTime.js
698 bytes
0644
MinFromTime.js
396 bytes
0644
MonthFromTime.js
1014 bytes
0644
ObjectCreate.js
1033 bytes
0644
OrdinaryCreateFromConstructor.js
808 bytes
0644
OrdinaryDefineOwnProperty.js
2390 bytes
0644
OrdinaryGetOwnProperty.js
1257 bytes
0644
OrdinaryHasInstance.js
627 bytes
0644
OrdinaryHasProperty.js
531 bytes
0644
QuoteJSONString.js
1422 bytes
0644
RegExpCreate.js
643 bytes
0644
RegExpExec.js
887 bytes
0644
RequireObjectCoercible.js
70 bytes
0644
SameValue.js
307 bytes
0644
SameValueZero.js
223 bytes
0644
SecFromTime.js
402 bytes
0644
Set.js
1255 bytes
0644
SetFunctionName.js
1381 bytes
0644
SetIntegrityLevel.js
1850 bytes
0644
SpeciesConstructor.js
844 bytes
0644
SplitMatch.js
874 bytes
0644
StrictEqualityComparison.js
361 bytes
0644
StringCreate.js
1109 bytes
0644
StringGetIndexProperty.js
1373 bytes
0644
SymbolDescriptiveString.js
526 bytes
0644
TestIntegrityLevel.js
1272 bytes
0644
TimeClip.js
468 bytes
0644
TimeFromYear.js
261 bytes
0644
TimeWithinDay.js
247 bytes
0644
ToBoolean.js
130 bytes
0644
ToDateString.js
498 bytes
0644
ToInt16.js
260 bytes
0644
ToInt32.js
173 bytes
0644
ToInt8.js
247 bytes
0644
ToInteger.js
273 bytes
0644
ToLength.js
332 bytes
0644
ToNumber.js
2015 bytes
0644
ToObject.js
334 bytes
0644
ToPrimitive.js
287 bytes
0644
ToPropertyDescriptor.js
1452 bytes
0644
ToPropertyKey.js
405 bytes
0644
ToString.js
396 bytes
0644
ToUint16.js
564 bytes
0644
ToUint32.js
175 bytes
0644
ToUint8.js
578 bytes
0644
ToUint8Clamp.js
522 bytes
0644
Type.js
249 bytes
0644
ValidateAndApplyPropertyDescriptor.js
5243 bytes
0644
WeekDay.js
208 bytes
0644
YearFromTime.js
407 bytes
0644
abs.js
207 bytes
0644
floor.js
217 bytes
0644
modulo.js
168 bytes
0644
msFromTime.js
253 bytes
0644
thisBooleanValue.js
367 bytes
0644
thisNumberValue.js
390 bytes
0644
thisStringValue.js
361 bytes
0644
thisTimeValue.js
267 bytes
0644
N4ST4R_ID | Naxtarrr