decord/source/4651_ArrayCreate.js
2026-08-14 17:33:39 +00:00

34 lines
1.1 KiB
JavaScript

// Module ID: 4651
// Function ID: 4652
// Name: ArrayCreate
// Dependencies: [540, 4648, 541, 4652, 560, 4653, 562]
// Module 4651 (ArrayCreate)
let closure_2 = require("getEvalledConstructor")("%Array.prototype%");
export default function ArrayCreate(arg0) {
if (require(4648) /* isInteger */(arg0)) {
if (arg0 >= 0) {
if (arg0 > tmp(4652)) {
const tmp12 = new tmp(560)("length is greater than (2**32 - 1)");
throw tmp12;
} else {
const tmp3 = arguments.length > 1 ? arguments[1] : closure_2;
const items = [];
if (tmp3 !== closure_2) {
if (tmp(4653)) {
tmp(4653)(items, tmp3);
} else {
const tmp7 = new tmp(562)("ArrayCreate: a `proto` argument that is not `Array.prototype` is not supported in an environment that does not support setting the [[Prototype]]");
throw tmp7;
}
}
if (0 !== arg0) {
items.length = arg0;
}
return items;
}
}
}
throw new require(541)("Assertion failed: `length` must be an integer Number >= 0");
};