From 30b58d938f47200924d0a7dcf745b95b862d03b5 Mon Sep 17 00:00:00 2001 From: Iku-turso Date: Mon, 9 Oct 2023 17:34:27 +0300 Subject: [PATCH] feat: Make public a way to break/abort flow of a pipeline With this, returning a "pipelineBreak" in a composed function of pipeline (or flow) will prevent execution of succeeding functions, while the pipeline also returns pipelineBreak. --- packages/fp/index.d.ts | 2 ++ packages/fp/index.js | 3 ++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/packages/fp/index.d.ts b/packages/fp/index.d.ts index 32bbba23..92d2304f 100644 --- a/packages/fp/index.d.ts +++ b/packages/fp/index.d.ts @@ -120,3 +120,5 @@ interface GetFrom { export const getFrom: GetFrom; export const getSafeFrom: GetFrom; + +export const pipelineBreak: Symbol; diff --git a/packages/fp/index.js b/packages/fp/index.js index c19d27b7..dea0960b 100644 --- a/packages/fp/index.js +++ b/packages/fp/index.js @@ -1,5 +1,5 @@ import awaitAll from './src/awaitAll/awaitAll'; -import flow from './src/flow/flow'; +import flow, { pipelineBreak } from './src/flow/flow'; import isPromise from './src/isPromise/isPromise'; import isPrimitive from './src/isPrimitive/isPrimitive'; import pipeline from './src/pipeline/pipeline'; @@ -16,4 +16,5 @@ export { mapValuesDeep, getFrom, getSafeFrom, + pipelineBreak, };