All Projects → nijikokun → Breeze

nijikokun / Breeze

Licence: mit
Javascript async flow control manager

Programming Languages

javascript
184084 projects - #8 most used programming language
es6
455 projects
flow
126 projects

Projects that are alternatives of or similar to Breeze

P Map
Map over promises concurrently
Stars: ✭ 639 (+1581.58%)
Mutual labels:  async, promise, promises, await
Tascalate Concurrent
Implementation of blocking (IO-Bound) cancellable java.util.concurrent.CompletionStage and related extensions to java.util.concurrent.ExecutorService-s
Stars: ✭ 144 (+278.95%)
Mutual labels:  async, promise, promises
Ws Promise Client
PROJECT MOVED: https://github.com/kdex/ws-promise
Stars: ✭ 6 (-84.21%)
Mutual labels:  async, promise, await
Awaitkit
The ES8 Async/Await control flow for Swift
Stars: ✭ 709 (+1765.79%)
Mutual labels:  async, promise, await
Swiftcoroutine
Swift coroutines for iOS, macOS and Linux.
Stars: ✭ 690 (+1715.79%)
Mutual labels:  async, promises, await
Functional Promises
Write code like a story w/ a powerful Fluent (function chaining) API
Stars: ✭ 141 (+271.05%)
Mutual labels:  async, promise, promises
Hydra
⚡️ Lightweight full-featured Promises, Async & Await Library in Swift
Stars: ✭ 1,954 (+5042.11%)
Mutual labels:  async, promises, await
Swimmer
🏊 Swimmer - An async task pooling and throttling utility for JS
Stars: ✭ 94 (+147.37%)
Mutual labels:  async, promises, await
ProtoPromise
Robust and efficient library for management of asynchronous operations in C#/.Net.
Stars: ✭ 20 (-47.37%)
Mutual labels:  promises, promise, await
combine-promises
Like Promise.all(array) but with an object instead of an array.
Stars: ✭ 181 (+376.32%)
Mutual labels:  promises, promise, await
Promise Fun
Promise packages, patterns, chat, and tutorials
Stars: ✭ 3,779 (+9844.74%)
Mutual labels:  async, promise, promises
Emacs Async Await
Async/Await for Emacs
Stars: ✭ 47 (+23.68%)
Mutual labels:  async, promise, await
Wx Promise Pro
✨强大、优雅的微信小程序异步库🚀
Stars: ✭ 762 (+1905.26%)
Mutual labels:  async, promise, await
Await Of
await wrapper for easier errors handling without try-catch
Stars: ✭ 240 (+531.58%)
Mutual labels:  async, promise, await
P Iteration
Utilities that make array iteration easy when using async/await or Promises
Stars: ✭ 337 (+786.84%)
Mutual labels:  async, promise, await
Modern Async
A modern JavaScript tooling library for asynchronous operations using async/await and promises
Stars: ✭ 31 (-18.42%)
Mutual labels:  async, promises, await
Nodespider
[DEPRECATED] Simple, flexible, delightful web crawler/spider package
Stars: ✭ 33 (-13.16%)
Mutual labels:  async, promise
Fritzbox.js
☎️ The leading AVM Fritz!Box API for NodeJS and JavaScript.
Stars: ✭ 36 (-5.26%)
Mutual labels:  async, promise
Kovenant
Kovenant. Promises for Kotlin.
Stars: ✭ 657 (+1628.95%)
Mutual labels:  async, promises
Csp
Communicating Sequential Processes in JavaScript
Stars: ✭ 33 (-13.16%)
Mutual labels:  async, await

Breeze

Functional async flow control library built on promises. Managing promises and async code has never been easier.

version License Downloads Dependencies

Features

  • Small footprint
  • Native promise support
  • No chaining required
  • Benchmarking (yes, even Promises)
  • Logging (Chain logs, argument logs, and more...)

Install

Usage

Node.js / Browserify / Webpack

const Breeze = require('breeze')

Documentation

Breeze Flow

import Breeze from 'breeze'

let flow = new Breeze()

Breeze Flow Instance Methods

then(method: Function|Promise)

Add step to flow chain.

flow
  .then(value => 'function with return value')
  .then(value => console.log('function says:', value))
  .then(new Promise((resolve, reject) => {
    return resolve('Promise resolution')
  }))
  .then(value => console.log('promise says:', value))

Note: You are not required to chain instance methods.

flow.then(value => 'function with return value')
flow.then(value => console.log('function says:', value))

catch(type?: ErrorType, handler: Function)

Handle chain rejections. Accepts an optional custom error type to capture specific rejections in the flow chain.

flow.then(() => throw new Error('Spoiler Alert'))

flow.catch(CustomError, err => console.log('Specialized Catch:', err))

flow.catch(err => console.log('Generic Catch:', err))

id(name: String)

Identify a step. Useful for benchmarking and logs.

// Create a flow step
flow.then(results => client.get('/users'))

// Identify step for benchmarking and logs
flow.id('fetch-users')

each(promises: Array, method: Function)

Invoke method on results of each Promise in the given Array.

Todo: Support previous chain Array<Promise> value.

all(promises: Array)

Map promise results to an array in order resolved.

map(promises: Array)

Map promise results to an array in given order.

skip(steps: Number)

Skip n steps after this point.

get(index: Number)

Obtain entry in array at given index in next step.

flow
  .then(() => [1,2,3])
  .get(0)
  .then(item => console.log(item)) // Outputs: 1

when(conditional: Function|Truthy, method: Function)

Invokes method when the conditional argument is truthy, otherwise skips to the next step.

flow
  .then(() => [1, 2, 3])
  .when(result => result[0] === 1, result => console.log(result[0], '=', 1))

This is a basic example to illustrate the small power of how you can make if statements asynchronous.

spread(method: Function)

Spreads each argument from a successful step as individual arguments on the passed method

flow
  .then(() => ['username', 'Steven Seagal'])
  .spread((field, value) => console.log(field, '=', value)) // username = Steven Seagal

tap(method: Function)

Invoke method without modifying the return result of the step, useful for inspection.

flow
  .then(() => [1, 2, 3])
  .tap(result => console.log(result))
  .then(result => console.log(result)) // [1,2,3]

return(value: any)

Convenience method for:

.then(() => value)

throw(reason: any)

Convenience method for:

.then(() => throw error)

License

Licensed under The MIT License.

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].