MCPcopy Create free account
hub / github.com/ICBNetwork/web3-Wallet / tameMathObject

Function tameMathObject

ses.cjs:4479–4514  ·  view source on GitHub ↗
(mathTaming=  'safe')

Source from the content-addressed store, hash-verified

4477
4478
4479function tameMathObject(mathTaming= 'safe') {
4480 if( mathTaming!== 'safe'&& mathTaming!== 'unsafe') {
4481 throw TypeError( `unrecognized mathTaming ${mathTaming}`);
4482 }
4483 const originalMath= Math;
4484 const initialMath= originalMath; // to follow the naming pattern
4485
4486 const { random: _, ...otherDescriptors}=
4487 getOwnPropertyDescriptors(originalMath);
4488
4489 // Use concise methods to obtain named functions without constructors.
4490 const tamedMethods= {
4491 /**
4492 * `%SharedMath%.random()` throws a TypeError starting with "secure mode".
4493 * See https://github.com/endojs/endo/issues/910#issuecomment-1581855420
4494 */
4495 random() {
4496 throw TypeError('secure mode %SharedMath%.random() throws');
4497 }};
4498
4499
4500 const sharedMath= create(objectPrototype, {
4501 ...otherDescriptors,
4502 random: {
4503 value: tamedMethods.random,
4504 writable: true,
4505 enumerable: false,
4506 configurable: true}});
4507
4508
4509
4510 return {
4511 '%InitialMath%': initialMath,
4512 '%SharedMath%': sharedMath};
4513
4514 }$h‍_once.default( tameMathObject);
4515})()
4516,
4517// === functors[16] ===

Callers 1

repairIntrinsicsFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected