prepack
Version:
Execute a JS bundle, serialize global state and side effects to a snapshot that can be quickly restored.
32 lines (23 loc) • 991 B
JavaScript
;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = function (realm) {
// ECMA262 19.3.1.1
let func = new _index.NativeFunctionValue(realm, "Boolean", "Boolean", 1, (context, [value], argCount, NewTarget) => {
// 1. Let b be ToBoolean(value).
let b = new _index.BooleanValue(realm, _singletons.To.ToBooleanPartial(realm, value));
// 2. If NewTarget is undefined, return b.
if (!NewTarget) return b;
// 3. Let O be ? OrdinaryCreateFromConstructor(NewTarget, "%BooleanPrototype%", « [[BooleanData]] »).
let O = _singletons.Create.OrdinaryCreateFromConstructor(realm, NewTarget, "BooleanPrototype", { $BooleanData: undefined });
// 4. Set the value of O's [[BooleanData]] internal slot to b.
O.$BooleanData = b;
// 5. Return O.
return O;
});
return func;
};
var _index = require("../../values/index.js");
var _singletons = require("../../singletons.js");
//# sourceMappingURL=Boolean.js.map