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

Function enable

ses.cjs:4903–4958  ·  view source on GitHub ↗
(path, obj, prop, desc)

Source from the content-addressed store, hash-verified

4901 {
4902 const debugProperties= new Set(overrideDebug);
4903 function enable(path, obj, prop, desc) {
4904 if( 'value'in desc&& desc.configurable) {
4905 const { value}= desc;
4906
4907 const isDebug= setHas(debugProperties, prop);
4908
4909 // We use concise method syntax to be `this` sensitive, but still
4910 // omit a prototype property or [[Construct]] behavior.
4911 // @ts-expect-error We know there is an accessor descriptor there
4912 const { get: getter, set: setter}= getOwnPropertyDescriptor(
4913 {
4914 get[ prop]() {
4915 return value;
4916 },
4917 set[ prop](newValue) {
4918 if( obj=== this) {
4919 throw TypeError(
4920 `Cannot assign to read only property '${String(
4921 prop)
4922 }' of '${path}'`);
4923
4924 }
4925 if( objectHasOwnProperty(this, prop)) {
4926 this[prop]= newValue;
4927 }else {
4928 if( isDebug) {
4929 // eslint-disable-next-line @endo/no-polymorphic-call
4930 console.error(TypeError( `Override property ${prop}`));
4931 }
4932 defineProperty(this, prop, {
4933 value: newValue,
4934 writable: true,
4935 enumerable: true,
4936 configurable: true});
4937
4938 }
4939 }},
4940
4941 prop);
4942
4943
4944 defineProperty(getter, 'originalValue', {
4945 value,
4946 writable: false,
4947 enumerable: false,
4948 configurable: false});
4949
4950
4951 defineProperty(obj, prop, {
4952 get: getter,
4953 set: setter,
4954 enumerable: desc.enumerable,
4955 configurable: desc.configurable});
4956
4957 }
4958 }
4959
4960 function enableProperty(path, obj, prop) {

Callers 4

enablePropertyFunction · 0.85
enableAllPropertiesFunction · 0.85
toggleMetricsOptInFunction · 0.85

Calls 2

getOwnPropertyDescriptorFunction · 0.85
definePropertyFunction · 0.85

Tested by

no test coverage detected