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

Function startsWith

packages/effect/src/Schema.ts:4431–4450  ·  view source on GitHub ↗
(
  startsWith: string,
  annotations?: Annotations.Filter<Schema.Type<S>>
)

Source from the content-addressed store, hash-verified

4429 * @since 3.10.0
4430 */
4431export const startsWith = <S extends Schema.Any>(
4432 startsWith: string,
4433 annotations?: Annotations.Filter<Schema.Type<S>>
4434) =>
4435<A extends string>(self: S & Schema<A, Schema.Encoded<S>, Schema.Context<S>>): filter<S> => {
4436 const formatted = JSON.stringify(startsWith)
4437 return self.pipe(
4438 filter(
4439 (a) => a.startsWith(startsWith),
4440 {
4441 schemaId: StartsWithSchemaId,
4442 [StartsWithSchemaId]: { startsWith },
4443 title: `startsWith(${formatted})`,
4444 description: `a string starting with ${formatted}`,
4445 jsonSchema: { pattern: `^${startsWith}` },
4446 ...annotations
4447 }
4448 )
4449 )
4450}
4451
4452/**
4453 * @category schema id

Callers

nothing calls this directly

Calls 2

filterFunction · 0.70
pipeMethod · 0.65

Tested by

no test coverage detected