From 85277274178d35ee3991510eceb137076bbef848 Mon Sep 17 00:00:00 2001 From: JUSTIVE Date: Wed, 5 Jun 2024 15:16:28 +0900 Subject: [PATCH] chore: consistent typo --- src/patterns.ts | 4 ++-- src/types/Pattern.ts | 4 ++-- tests/strings.test.ts | 1 + 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/patterns.ts b/src/patterns.ts index adbc2495..dd821f87 100644 --- a/src/patterns.ts +++ b/src/patterns.ts @@ -713,13 +713,13 @@ const minLength = (min: min) => when((value) => isString(value) && value.length >= min); /** - * `P.string.length(len)` is a pattern, matching **strings** with at exact `len` characters. + * `P.string.length(len)` is a pattern, matching **strings** with exact `len` characters. * * [Read the documentation for `P.string.length` on GitHub](https://github.com/gvergnaud/ts-pattern#pstringlength) * * @example * match(value) - * .with(P.string.minLength(10), () => 'string with more length >= 10') + * .with(P.string.length(10), () => 'strings with length === 10') */ const length = (len: len) => when((value) => isString(value) && value.length === len); diff --git a/src/types/Pattern.ts b/src/types/Pattern.ts index b6aefa58..86e2a776 100644 --- a/src/types/Pattern.ts +++ b/src/types/Pattern.ts @@ -314,13 +314,13 @@ export type StringChainable< omitted | 'minLength' >; /** - * `P.string.length(len)` is a pattern, matching **strings** with at exact `len` characters. + * `P.string.length(len)` is a pattern, matching **strings** with exact `len` characters. * * [Read the documentation for `P.string.length` on GitHub](https://github.com/gvergnaud/ts-pattern#pstringlength) * * @example * match(value) - * .with(P.string.length(10), () => 'string with exact length === 10') + * .with(P.string.length(10), () => 'strings with length === 10') */ length( len: len diff --git a/tests/strings.test.ts b/tests/strings.test.ts index 7a9d2160..56b0672e 100644 --- a/tests/strings.test.ts +++ b/tests/strings.test.ts @@ -121,6 +121,7 @@ describe('Strings', () => { }); expect(f('aa')).toBe('yes'); + expect(f('bb')).toBe('yes'); expect(f('aaa')).toBe('no'); expect(f('a')).toBe('no'); });