- Notifications
You must be signed in to change notification settings - Fork3
Bring back Fluture's fluent method API
License
fluture-js/fluenture
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
Brings backFluture's fluent method API, for the nostalgic developer.
$npm install --save fluenture
On Node 12 and up, this module can be loaded directly withimport
orrequire
. On Node versions below 12,require
or theesm-loader canbe used.
You can load the EcmaScript module from various content delivery networks:
There's aUMD file included in the NPM package, also available viajsDelivr:https://cdn.jsdelivr.net/npm/fluenture@3.1.0/dist/umd.js
This file addsfluenture
to the global scope, or use CommonJS/AMDwhen available.
import{resolve,reject}from'fluture';import{fluent}from'fluenture';fluent(resolve(42)).map(x=>x/2).chain(x=>reject(x+21)).swap().fork(console.error,console.log)
We're using theFluenture a b
type here to denote instances of Futurethat were enhanced with a fluent method API. One can think of theFluenture
type as asubtype ofFuture
: any instances of it are alsoinstances ofFuture
.
Enhance a Future with the fluent method API.
This function is idempotent.
Strip a fluent Future (or "Fluenture") from its method API.
This function is idempotent.
This function is equivalent to Fluture's built-inpipe
function, withonce exception; If a Future is returned from the given function, it isautomatically wrapped usingfluent
, so as to keep the fluentmethod chain intact.
Fluentpipe
.
Fluentalt
.
Fluentand
.
Fluentap
.
Fluentbichain
.
Fluentbimap
.
Fluentboth
.
Fluentcache
.
Fluentchain
.
FluentchainRej
.
Fluentcoalesce
.
Fluentlastly
.
Fluentmap
.
FluentmapRej
.
Fluentpap
.
Fluentrace
.
Fluentswap
.
Fluentdone
.
Fluentfork
.
FluentforkCatch
.
Fluentpromise
.
Fluentvalue
.
About
Bring back Fluture's fluent method API