MCPcopy
hub / github.com/gvergnaud/ts-pattern / length

Function length

src/patterns.ts:857–858  ·  view source on GitHub ↗
(len: len)

Source from the content-addressed store, hash-verified

855 * .with(P.string.length(10), () => 'strings with length === 10')
856 */
857const length = <const len extends number>(len: len) =>
858 when((value) => isString(value) && value.length === len);
859
860/**
861 * `P.string.maxLength(max)` is a pattern, matching **strings** with at most `max` characters.

Callers 1

stringChainableFunction · 0.85

Calls 2

whenFunction · 0.85
isStringFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…