From def5506380f7f001fbe9fba738b06d2d20c4f087 Mon Sep 17 00:00:00 2001 From: Michael Tyson Date: Tue, 14 May 2024 03:03:09 +0000 Subject: [PATCH] chore: Update Deno dependencies and typescript version Signed-off-by: Michael Tyson --- deno.jsonc | 1 - deps.ts | 2 +- promise-chain.ts | 16 +++++++++++++++- stubs/test-class.ts | 2 +- 4 files changed, 17 insertions(+), 4 deletions(-) diff --git a/deno.jsonc b/deno.jsonc index be13720..06218a8 100644 --- a/deno.jsonc +++ b/deno.jsonc @@ -1,5 +1,4 @@ { - "name": "@myty/promise-chain", "version": "0.4.5", "exports": "./mod.ts", diff --git a/deps.ts b/deps.ts index 847c1ee..0947398 100644 --- a/deps.ts +++ b/deps.ts @@ -2,7 +2,7 @@ export { assert, assertEquals, assertRejects, -} from "https://deno.land/std@0.224.0/testing/asserts.ts"; +} from "https://deno.land/std@0.224.0/assert/mod.ts"; export { assertSpyCalls, spy, diff --git a/promise-chain.ts b/promise-chain.ts index 270f358..fc81d85 100644 --- a/promise-chain.ts +++ b/promise-chain.ts @@ -1,8 +1,22 @@ -import { PromiseChainable, PromiseChainableConstructor } from "./types.ts"; +import type { PromiseChainable, PromiseChainableConstructor } from "./types.ts"; /** * Utility class to wrap a composition class with the intended purpose of chaining methods, specifically useful for * functions that return Promises. Note: Promise functions and non-promise functions can be mixed. + * + * ### Example + * + * ```ts + * const testClass = new TestClassWithSyncAndAsyncMethods(); + * const result = await PromiseChain(testClass) + .asyncIncrement("propertyOne", 3) + .asyncIncrementTwo() + .asyncIncrementOne() + .increment("propertyTwo", 5) + .increment("propertyOne", 2) + .asyncIncrementOne(); + * ``` + * */ const PromiseChain = function >( this: PromiseChainable | void, diff --git a/stubs/test-class.ts b/stubs/test-class.ts index 5a2c9fc..a5b86a3 100644 --- a/stubs/test-class.ts +++ b/stubs/test-class.ts @@ -1,4 +1,4 @@ -import { PickMatching } from "../types.ts"; +import type { PickMatching } from "../types.ts"; type PickNumbers = PickMatching;