Skip to content

Commit

Permalink
Merge pull request #128 from seasonedcc/tweaking-modules-exports
Browse files Browse the repository at this point in the history
Tweaking module exports
  • Loading branch information
gustavoguichard authored Jan 10, 2024
2 parents 89f6188 + 97c45a3 commit 393a7d6
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 8 deletions.
2 changes: 1 addition & 1 deletion deno.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"version": "2.5.2-rc.1",
"version": "2.5.2-rc.3",
"tasks": {
"test": "deno test --allow-env --allow-net --unstable src",
"publish": "deno task build-npm && cd npm/ && npm publish",
Expand Down
12 changes: 6 additions & 6 deletions src/composable/composable.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ function composable<T extends Fn>(fn: T): Composable<T> {
/**
* Creates a single function out of a chain of multiple Composables. It will pass the output of a function as the next function's input in left-to-right order. The resulting data will be the output of the rightmost function.
* @example
* import { composable as C } from 'domain-functions'
* import { cf as C } from 'domain-functions'
*
* const a = C.composable(
* ({ aNumber }: { aNumber: number }) => ({ aString: String(aNumber) }),
Expand All @@ -86,7 +86,7 @@ function pipe<T extends [Composable, ...Composable[]]>(
/**
* Creates a single function out of multiple Composables. It will pass the same input to each provided function. The functions will run in parallel. If all constituent functions are successful, The data field will be a tuple containing each function's output.
* @example
* import { composable as C } from 'domain-functions'
* import { cf as C } from 'domain-functions'
*
* const a = C.composable((id: number) => id + 1)
* const b = C.composable(String)
Expand Down Expand Up @@ -115,7 +115,7 @@ function all<T extends [Composable, ...Composable[]]>(
/**
* Receives a Record of Composables, runs them all in parallel and preserves the shape of this record for the data property in successful results.
* @example
* import { composable as C } from 'domain-functions'
* import { cf as C } from 'domain-functions'
*
* const a = C.composable(() => '1')
* const b = C.composable(() => 2)
Expand All @@ -138,7 +138,7 @@ function collect<T extends Record<string, Composable>>(
/**
* Works like `pipe` but it will collect the output of every function in a tuple.
* @example
* import { composable as C } from 'domain-functions'
* import { cf as C } from 'domain-functions'
*
* const a = C.compose((aNumber: number) => String(aNumber))
* const b = C.compose((aString: string) => aString === '1')
Expand Down Expand Up @@ -169,7 +169,7 @@ function sequence<T extends [Composable, ...Composable[]]>(
/**
* It takes a Composable and a predicate to apply a transformation over the resulting `data`. It only runs if the function was successfull. When the given function fails, its error is returned wihout changes.
* @example
* import { composable as C } from 'domain-functions'
* import { cf as C } from 'domain-functions'
*
* const increment = C.composable(({ id }: { id: number }) => id + 1)
* const incrementToString = C.map(increment, String)
Expand All @@ -191,7 +191,7 @@ function map<T extends Composable, R>(
/**
* Creates a new function that will apply a transformation over a resulting Failure from the given function. When the given function succeeds, its result is returned without changes.
* @example
* import { composable as C } from 'domain-functions'
* import { cf as C } from 'domain-functions'
*
* const increment = C.composable(({ id }: { id: number }) => id + 1)
* const incrementWithErrorSummary = C.mapError(increment, (result) => ({
Expand Down
3 changes: 2 additions & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ export * from './errors.ts'
export { mergeObjects } from './composable/composable.ts'
export type { Composable } from './composable/index.ts'
import * as composable from './composable/index.ts'
export { composable }
export { toErrorWithMessage } from './composable/errors.ts'
export { composable as cf }
export type {
AtLeastOne,
DomainFunction,
Expand Down

0 comments on commit 393a7d6

Please sign in to comment.