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

Function isPattern

packages/effect/src/Schema.ts:6745–6758  ·  view source on GitHub ↗
(
  regExp: globalThis.RegExp,
  annotations?: Annotations.Filter
)

Source from the content-addressed store, hash-verified

6743 * @since 4.0.0
6744 */
6745export function isPattern(
6746 regExp: globalThis.RegExp,
6747 annotations?: Annotations.Filter
6748): SchemaAST.Filter<string> {
6749 const source = regExp.source
6750 const flags = regExp.flags
6751 const runtimeRegExp = flags === ""
6752 ? `new RegExp(${format(source)})`
6753 : `new RegExp(${format(source)}, ${format(flags)})`
6754 return SchemaAST.isPattern(regExp, {
6755 toCode: () => ({ runtime: `Schema.isPattern(${runtimeRegExp})` }),
6756 ...annotations
6757 })
6758}
6759
6760const IsPatternPayload = Struct({
6761 source: String,

Callers 6

Schema.tsFile · 0.70
isUUIDFunction · 0.70
isGUIDFunction · 0.70
isULIDFunction · 0.70
isBase64Function · 0.70
isBase64UrlFunction · 0.70

Calls 1

formatFunction · 0.90

Tested by

no test coverage detected