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

Function fromConst

packages/effect/src/SchemaAST.ts:3798–3808  ·  view source on GitHub ↗
(
  ast: AST,
  value: T
)

Source from the content-addressed store, hash-verified

3796}
3797
3798function fromConst<const T>(
3799 ast: AST,
3800 value: T
3801): SchemaParser.Parser {
3802 const succeed = InternalParser.succeed(value)
3803 return (input, options) => {
3804 if (input === InternalParser.missing) return InternalParser.missingExit
3805 if (input === value) return succeed
3806 return Effect.fail(new SchemaIssue.InvalidType(ast, input, options))
3807 }
3808}
3809
3810function fromRefinement<T>(
3811 ast: AST,

Callers 4

getParserMethod · 0.85
getParserMethod · 0.85
getParserMethod · 0.85
getParserMethod · 0.85

Calls 2

succeedMethod · 0.45
failMethod · 0.45

Tested by

no test coverage detected