MCPcopy Create free account
hub / github.com/effect-app/libs / OptionFromOptionalNullOr

Function OptionFromOptionalNullOr

repos/effect/packages/effect/src/Schema.ts:8725–8744  ·  view source on GitHub ↗
(
  schema: S,
  options?: {
    readonly onNoneEncoding: "omit" | null | undefined
  }
)

Source from the content-addressed store, hash-verified

8723 *
8724 * @category validation
8725 * @since 4.0.0
8726 */
8727export function isPropertyNames(keySchema: Constraint, annotations?: Annotations.Filter) {
8728 const propertyNames = toEncoded(keySchema)
8729 const parser = SchemaParser._issue(propertyNames.ast)
8730 return makeFilter<object>(
8731 (input, ast, options) => {
8732 const keys = Reflect.ownKeys(input)
8733 const issues: Array<SchemaIssue.Issue> = []
8734 for (const key of keys) {
8735 const issue = parser(key, options)
8736 if (issue !== undefined) {
8737 issues.push(new SchemaIssue.Pointer([key], issue))
8738 if (options.errors === "first") break
8739 }
8740 }
8741 if (Arr.isArrayNonEmpty(issues)) {
8742 return new SchemaIssue.Composite(ast, issues, input, options)
8743 }
8744 return true
8745 },
8746 {
8747 expected: "an object with property names matching the schema",

Callers

nothing calls this directly

Calls 8

toTypeInterface · 0.85
filterMethod · 0.80
someMethod · 0.80
optionalInterface · 0.70
NullOrInterface · 0.70
decodeToFunction · 0.70
OptionFunction · 0.70
pipeMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…