MCPcopy Create free account
hub / github.com/Effect-TS/effect / get

Function get

packages/sql-kysely/src/internal/patch.ts:39–67  ·  view source on GitHub ↗
(target, prop, receiver)

Source from the content-addressed store, hash-verified

37 }
38 return new Proxy(obj, {
39 get(target, prop, receiver) {
40 // Proxy invariants require returning fixed properties unchanged.
41 const desc = Object.getOwnPropertyDescriptor(target, prop)
42 if (desc && !desc.configurable && !desc.writable) {
43 return target[prop]
44 }
45 const prototype = Object.getPrototypeOf(target)
46 if (Effect.EffectTypeId in prototype && prop === "commit") {
47 return commit.bind(target, plugins)
48 }
49 if (typeof (target[prop]) === "function") {
50 if (typeof prop === "string" && whitelist.includes(prop)) {
51 return target[prop].bind(target)
52 }
53 return (...args: Array<unknown>) => {
54 // Callback helpers need the proxy to retain plugin tracking.
55 if (prop === "$call" || (prop === "$if" && args[0])) {
56 return target[prop].call(receiver, ...args)
57 }
58 return effectifyWith(
59 target[prop].call(target, ...args),
60 commit,
61 whitelist,
62 prop === "withPlugin" ? [...plugins, args[0] as KyselyPlugin] : prop === "withoutPlugins" ? [] : plugins
63 )
64 }
65 }
66 return effectifyWith(target[prop], commit, whitelist, plugins)
67 }
68 })
69}
70

Callers

nothing calls this directly

Calls 1

effectifyWithFunction · 0.85

Tested by

no test coverage detected