prepack
Version:
Execute a JS bundle, serialize global state and side effects to a snapshot that can be quickly restored.
41 lines (31 loc) • 1.33 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = _default;
var _index = require("../../values/index.js");
var _singletons = require("../../singletons.js");
/**
* Copyright (c) 2017-present, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*/
/* strict-local */
function _default(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;
}
//# sourceMappingURL=Boolean.js.map