All Projects → darky → rocket-pipes

darky / rocket-pipes

Licence: MIT license
Powerful pipes for TypeScript, that chain Promise and ADT for you 🚌 -> ⛰️ -> 🚠 -> 🏂 -> 🚀

Programming Languages

typescript
32286 projects
javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to rocket-pipes

Promised Pipe
A ramda.pipe-like utility that handles promises internally with zero dependencies
Stars: ✭ 64 (+255.56%)
Mutual labels:  promise, pipe, composition, ramda
Ttyplot
a realtime plotting utility for terminal/console with data input from stdin
Stars: ✭ 532 (+2855.56%)
Mutual labels:  pipeline, pipe
Pipeline
Pipeline is a package to build multi-staged concurrent workflows with a centralized logging output.
Stars: ✭ 433 (+2305.56%)
Mutual labels:  pipeline, pipe
Hookah
A cross-platform tool for data pipelines.
Stars: ✭ 83 (+361.11%)
Mutual labels:  pipeline, pipe
etran
Erlang Parse Transforms Including Fold (MapReduce) comprehension, Elixir-like Pipeline, and default function arguments
Stars: ✭ 19 (+5.56%)
Mutual labels:  pipeline, pipe
pypely
Make your data processing easy
Stars: ✭ 17 (-5.56%)
Mutual labels:  pipeline, pipe
Nodespider
[DEPRECATED] Simple, flexible, delightful web crawler/spider package
Stars: ✭ 33 (+83.33%)
Mutual labels:  pipeline, promise
Functional Promises
Write code like a story w/ a powerful Fluent (function chaining) API
Stars: ✭ 141 (+683.33%)
Mutual labels:  promise, composition
Onhold
🔊 Play sounds while and after shell jobs complete
Stars: ✭ 146 (+711.11%)
Mutual labels:  pipeline, pipe
Fluids
Fluid dynamics component of Chemical Engineering Design Library (ChEDL)
Stars: ✭ 154 (+755.56%)
Mutual labels:  pipeline, pipe
Pipeline.rs
☔️ => ⛅️ => ☀️
Stars: ✭ 188 (+944.44%)
Mutual labels:  pipeline, pipe
tpack
Pack a Go workflow/function as a Unix-style pipeline command
Stars: ✭ 55 (+205.56%)
Mutual labels:  pipeline, pipe
Ppipe
pipes values through functions, an alternative to using the proposed pipe operator ( |> ) for ES
Stars: ✭ 192 (+966.67%)
Mutual labels:  promise, pipe
pipe-trait
Make it possible to chain regular functions
Stars: ✭ 22 (+22.22%)
Mutual labels:  pipeline, pipe
Metasync
Asynchronous Programming Library for JavaScript & Node.js
Stars: ✭ 164 (+811.11%)
Mutual labels:  promise, composition
Param pipe
parameterized pipe in elixir: |n>
Stars: ✭ 14 (-22.22%)
Mutual labels:  pipeline, pipe
do
Simplest way to manage asynchronicity
Stars: ✭ 33 (+83.33%)
Mutual labels:  promise, composition
pipe
Functional Pipeline in Go
Stars: ✭ 30 (+66.67%)
Mutual labels:  pipeline, pipe
Pex Context
Modern WebGL state wrapper for PEX: allocate GPU resources (textures, buffers), setup state pipelines and passes, and combine them into commands.
Stars: ✭ 117 (+550%)
Mutual labels:  pipeline, context
CNeptune
CNeptune improve productivity & efficiency by urbanize .net module with meta-code to lay foundation for frameworks
Stars: ✭ 30 (+66.67%)
Mutual labels:  mock, aop

Rocket pipes

Powerful pipes for TypeScript, that chain Promise and ADT like Maybe or Either from popular FP libraries.

Features

  • 🍬 Sugar pipes. No worries about promises or ADT itself. Work with resolved values directly.
  • 💡 Type inference. No worries about manual typing work. Types of resolved values inferred automatically.
  • ⛓️ FP libraries friendly. Understand Catamorphism/Foldable libraries.
  • 🖇️ Mix of Promise with FP library. Yes! Catamorphism/Foldable can be included in Promise.
  • 📉 Context. Easy pass context through all pipes.
  • 🚪 Pipeline exit (even nested exit). You can exit from any place of pipeline with result value (it's also have proper type inference 🤘)
  • 🏹 Pipeline replace. You can replace function on pipeline to another on the fly. Useful for mock testing.
  • AOP. Use beforeAll/afterAll hooks for your pipelines.
  • 🦥 Lazy. Pipeline returns function, that can be used later. It's friendly with Ramda or Sanctuary.

Library support

Vanilla Monet Purify fp-ts RxJS / IxJS
Promise Either Either Either pipe
Maybe Maybe Promise<Either>
Validation EitherAsync
Promise<Either> MaybeAsync
Promise<Maybe> Promise<Either>
Promise<Validation> Promise<Maybe>
Promise<EitherAsync>
Promise<MaybeAsync>

if you want slim version without libraries support, install slim version npm install rocket-pipes-slim

Examples

Basic
const resp = await p(
  () => 123,
  (n) => n + 1
)();
expect(resp + 1).toEqual(125);
Context
const resp = await p(
  () => 123,
  pc((ctx: {n: number}) => n => n + ctx.n),
  n => n + 1
).context({n: 1})();
expect(resp + 1).toEqual(126);
Exit pipeline
const resp = await p(
  () => 123,
  (n) => ep(n + 1),
  (n) => "qwe"
)();
iep(resp) && expect(resp.r + 1).toEqual(125);
Replace pipeline
const fn = p(
  () => 123,
  (n) => n + 1
);
const resp = await fn.replace([[0, () => 124]])();
expect(resp + 1).toEqual(126);

fn.replaceUndo();
expect(await fn()).toEqual(125);
AOP beforeAll/afterAll hooks
beforeAll((label, n) => {
  expect(label).toEqual("(n) => n + 1\n(n) => n + 1");
  expect(n).toEqual(123);
});
afterAll((label, n) => {
  expect(label).toEqual("(n) => n + 1\n(n) => n + 1");
  expect(n).toEqual(125);
});
p(
  (n: number) => n + 1,
  (n) => n + 1
)(123);
AOP clear hooks
clearAfterAll();
clearBeforeAll();
Promise basic
const resp = await p(
  () => Promise.resolve(123),
  (n) => n + 1
)();
expect(resp + 1).toEqual(125);
Either right
const resp = await p(
  () => Either.right(123),
  (n) => n + 1
)();
expect(resp + 1).toEqual(125);
Promise can include anything supported
const resp = await p(
  () => Promise.resolve(Either.right(123)),
  (n) => n + 1
)();
expect(resp + 1).toEqual(125);
Either left
const resp = await p(
  () => Either.left(123),
  (_, l) => l + 1
)();
expect(resp + 1).toEqual(125);
Maybe some
const resp = await p(
  () => Maybe.some(123),
  (n) => n + 1
)();
expect(resp + 1).toEqual(125);
Maybe none
const resp = await p(
  () => Maybe.none(),
  (s, n) => s || n
)();
expect(resp).toEqual(void 0);
Validation success
const resp = await p(
  () => Validation.success(123),
  (n) => n + 1
)();
expect(resp + 1).toEqual(125);
Validation fail
const resp = await p(
  () => Validation.fail(123),
  (_, l) => l + 1
)();
expect(resp + 1).toEqual(125);
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].