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

Function initProperty

ses.cjs:3722–3738  ·  view source on GitHub ↗
(obj, name, desc)

Source from the content-addressed store, hash-verified

3720// get masked as one overwrites the other. Accordingly, the thrown error
3721// complains of a "Conflicting definition".
3722function initProperty(obj, name, desc) {
3723 if( objectHasOwnProperty(obj, name)) {
3724 const preDesc= getOwnPropertyDescriptor(obj, name);
3725 if(
3726 !preDesc||
3727 !is(preDesc.value, desc.value)||
3728 preDesc.get!== desc.get||
3729 preDesc.set!== desc.set||
3730 preDesc.writable!== desc.writable||
3731 preDesc.enumerable!== desc.enumerable||
3732 preDesc.configurable!== desc.configurable)
3733 {
3734 throw TypeError( `Conflicting definitions of ${name}`);
3735 }
3736 }
3737 defineProperty(obj, name, desc);
3738 }
3739
3740// Like defineProperties, but throws if it would modify an existing property.
3741// This ensures that the intrinsics added to the intrinsics collector object

Callers 1

initPropertiesFunction · 0.85

Calls 2

getOwnPropertyDescriptorFunction · 0.85
definePropertyFunction · 0.85

Tested by

no test coverage detected