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

Function fnUntraced

packages/effect/src/internal/effect.ts:1198–1214  ·  view source on GitHub ↗
(
  body: Function,
  ...pipeables: Array<any>
)

Source from the content-addressed store, hash-verified

1196
1197/** @internal */
1198export const fnUntraced: Effect.fn.Untraced = (
1199 body: Function,
1200 ...pipeables: Array<any>
1201) => {
1202 const fn = pipeables.length === 0
1203 ? function(this: any) {
1204 return suspend(() => fromIteratorUnsafe(body.apply(this, arguments)))
1205 }
1206 : function(this: any) {
1207 let effect = suspend(() => fromIteratorUnsafe(body.apply(this, arguments)))
1208 for (let i = 0; i < pipeables.length; i++) {
1209 effect = pipeables[i](effect, ...arguments)
1210 }
1211 return effect
1212 }
1213 return defineFunctionLength(body.length, fn)
1214}
1215
1216const defineFunctionLength = <F extends Function>(length: number, fn: F): F =>
1217 Object.defineProperty(fn, "length", {

Callers 1

effect.tsFile · 0.85

Calls 2

defineFunctionLengthFunction · 0.85
suspendFunction · 0.50

Tested by

no test coverage detected