From 94bd4818d01f4f0a425c8b60403cf957c2f0dc34 Mon Sep 17 00:00:00 2001 From: Joel Lefkowitz Date: Sun, 14 Jul 2024 16:32:52 +0100 Subject: [PATCH] Format function docstrings --- src/factories/transform.ts | 7 ++++--- src/factories/validate.spec.ts | 10 ++++++++-- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/src/factories/transform.ts b/src/factories/transform.ts index 5096f30..bf227f8 100644 --- a/src/factories/transform.ts +++ b/src/factories/transform.ts @@ -140,7 +140,8 @@ export const either = * }; * * @typeParam T - The validated type - * @param first - The validator + * @param first - The validator */ -export const optional = (validator: Validator): Validator => - either(validator, isUndefined); +export const optional = ( + validator: Validator, +): Validator => either(validator, isUndefined); diff --git a/src/factories/validate.spec.ts b/src/factories/validate.spec.ts index c66591c..13f04db 100644 --- a/src/factories/validate.spec.ts +++ b/src/factories/validate.spec.ts @@ -75,7 +75,10 @@ describe("validateWith", () => { expect(validator({ a: "1" }).parsed).toEqual({ a: "1", b: undefined }); expect(validator({ a: "1", b: undefined }).valid).toBe(true); - expect(validator({ a: "1", b: undefined }).parsed).toEqual({ a: "1", b: undefined }); + expect(validator({ a: "1", b: undefined }).parsed).toEqual({ + a: "1", + b: undefined, + }); expect(validator({ a: "1", b: 1 }).error).toEqual({ b: "Not a string: 1" }); expect(validator({ a: "1", b: "1" }).parsed).toEqual({ a: "1", b: 1 }); @@ -144,7 +147,10 @@ describe("validateWithAtLeast", () => { expect(validator({ a: "1" }).parsed).toEqual({ a: "1", b: undefined }); expect(validator({ a: "1", b: undefined }).valid).toBe(true); - expect(validator({ a: "1", b: undefined }).parsed).toEqual({ a: "1", b: undefined }); + expect(validator({ a: "1", b: undefined }).parsed).toEqual({ + a: "1", + b: undefined, + }); expect(validator({ a: "1", b: 1 }).error).toEqual({ b: "Not a string: 1" }); expect(validator({ a: "1", b: "1" }).parsed).toEqual({ a: "1", b: 1 });