MCPcopy Index your code
hub / github.com/Effect-TS/effect / brand

Function brand

packages/effect/src/Schema.ts:3197–3214  ·  view source on GitHub ↗
(
  brand: B,
  annotations?: Annotations.Schema<Schema.Type<S> & Brand<B>>
)

Source from the content-addressed store, hash-verified

3195 * @since 3.10.0
3196 */
3197export const brand = <S extends Schema.Any, B extends string | symbol>(
3198 brand: B,
3199 annotations?: Annotations.Schema<Schema.Type<S> & Brand<B>>
3200) =>
3201(self: S): brand<S, B> => {
3202 const annotation: AST.BrandAnnotation = option_.match(AST.getBrandAnnotation(self.ast), {
3203 onNone: () => [brand],
3204 onSome: (brands) => [...brands, brand]
3205 })
3206 const ast = AST.annotations(
3207 self.ast,
3208 toASTAnnotations({
3209 [AST.BrandAnnotationId]: annotation,
3210 ...annotations
3211 })
3212 )
3213 return makeBrandClass(self, ast)
3214}
3215
3216/**
3217 * @category combinators

Callers

nothing calls this directly

Calls 3

toASTAnnotationsFunction · 0.85
makeBrandClassFunction · 0.85
annotationsMethod · 0.65

Tested by

no test coverage detected