MCPcopy Index your code
hub / github.com/nodejs/node / propHasGetterOrIsProxy

Function propHasGetterOrIsProxy

lib/internal/repl/completion.js:783–798  ·  view source on GitHub ↗

* Given an object and a property name, checks whether the property has a getter, if not checks whether its * value is a proxy. * * Note: the order is relevant here, we want to check whether the property has a getter _before_ we check * whether its value is a proxy, to ensure that is the pr

(obj, prop, cb)

Source from the content-addressed store, hash-verified

781 * @returns {void}
782 */
783function propHasGetterOrIsProxy(obj, prop, cb) {
784 const propDescriptor = ObjectGetOwnPropertyDescriptor(
785 obj,
786 prop,
787 );
788 const propHasGetter = typeof propDescriptor?.get === 'function';
789 if (propHasGetter) {
790 return cb(true);
791 }
792
793 if (isProxy(obj[prop])) {
794 return cb(true);
795 }
796
797 return cb(false);
798}
799
800module.exports = {
801 complete,

Callers 1

hasGetterOrIsProxyFunction · 0.85

Calls 1

cbFunction · 0.50

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…