MCPcopy
hub / github.com/mobxjs/mobx / copyStaticProperties

Function copyStaticProperties

packages/mobx-react/src/utils/utils.ts:49–56  ·  view source on GitHub ↗
(base: object, target: object)

Source from the content-addressed store, hash-verified

47}
48
49export function copyStaticProperties(base: object, target: object): void {
50 const protoProps = Object.getOwnPropertyNames(Object.getPrototypeOf(base))
51 Object.getOwnPropertyNames(base).forEach(key => {
52 if (!hoistBlackList[key] && protoProps.indexOf(key) === -1) {
53 Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(base, key)!)
54 }
55 })
56}
57
58/**
59 * Helper to set `prop` to `this` as non-enumerable (hidden prop)

Callers 1

createStoreInjectorFunction · 0.90

Calls 1

forEachMethod · 0.45

Tested by

no test coverage detected