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

Function instanceOf

packages/effect/src/Filter.ts:354–356  ·  view source on GitHub ↗
(constructor: K)

Source from the content-addressed store, hash-verified

352 */
353export const instanceOf =
354 <K extends new(...args: any) => any>(constructor: K) =>
355 <Input>(u: Input): Result.Result<InstanceType<K>, Exclude<Input, InstanceType<K>>> =>
356 u instanceof constructor ? Result.succeed(u as InstanceType<K>) : Result.fail(u) as any
357
358/**
359 * A predefined filter that only passes through number values.

Callers

nothing calls this directly

Calls 2

succeedMethod · 0.45
failMethod · 0.45

Tested by

no test coverage detected