MCPcopy Create free account
hub / github.com/middleapi/orpc / value

Function value

packages/shared/src/value.ts:3–12  ·  view source on GitHub ↗
(
  value: Value<T, TArgs>,
  ...args: NoInfer<TArgs>
)

Source from the content-addressed store, hash-verified

1export type Value<T, TArgs extends any[] = []> = T | ((...args: TArgs) => T)
2
3export function value<T, TArgs extends any[]>(
4 value: Value<T, TArgs>,
5 ...args: NoInfer<TArgs>
6): T extends Value<infer U, any> ? U : never {
7 if (typeof value === 'function') {
8 return (value as any)(...args)
9 }
10
11 return value as any
12}
13
14/**
15 * Returns the value if it is defined, otherwise returns the fallback

Callers 15

encodeMethod · 0.90
constructorMethod · 0.90
initMethod · 0.90
#executeBatchMethod · 0.90
initMethod · 0.90
nextMethod · 0.90
initMethod · 0.90
initMethod · 0.90
generateMethod · 0.90
#errorResponseMethod · 0.90
initMethod · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected