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

Function isImmutableDataProperty

ses.cjs:6075–6096  ·  view source on GitHub ↗
(obj, name)

Source from the content-addressed store, hash-verified

6073 */$h‍_once.isValidIdentifierName(isValidIdentifierName);
6074
6075function isImmutableDataProperty(obj, name) {
6076 const desc= getOwnPropertyDescriptor(obj, name);
6077 return(
6078 desc&&
6079 //
6080 // The getters will not have .writable, don't let the falsyness of
6081 // 'undefined' trick us: test with === false, not ! . However descriptors
6082 // inherit from the (potentially poisoned) global object, so we might see
6083 // extra properties which weren't really there. Accessor properties have
6084 // 'get/set/enumerable/configurable', while data properties have
6085 // 'value/writable/enumerable/configurable'.
6086 desc.configurable=== false&&
6087 desc.writable=== false&&
6088 //
6089 // Checks for data properties because they're the only ones we can
6090 // optimize (accessors are most likely non-constant). Descriptors can't
6091 // can't have accessors and value properties at the same time, therefore
6092 // this check is sufficient. Using explicit own property deal with the
6093 // case where Object.prototype has been poisoned.
6094 objectHasOwnProperty(desc, 'value'));
6095
6096 }
6097
6098/**
6099 * getScopeConstants()

Callers 1

getScopeConstantsFunction · 0.85

Calls 1

getOwnPropertyDescriptorFunction · 0.85

Tested by

no test coverage detected