From 9385fdcd8a9176e2f044004abaa385a47f1e14f0 Mon Sep 17 00:00:00 2001 From: Aldwin Vlasblom Date: Tue, 6 Apr 2021 14:11:37 +0200 Subject: [PATCH] Version 3.1.0 --- README.md | 78 ++++++++++++++++++++++++++++++++++++---------------- index.js | 8 +++--- package.json | 2 +- 3 files changed, 59 insertions(+), 29 deletions(-) diff --git a/README.md b/README.md index 33924ef..cb124a4 100644 --- a/README.md +++ b/README.md @@ -4,6 +4,34 @@ Brings back [Fluture][]'s fluent method API, for the nostalgic developer. ## Usage +### Node + +```console +$ npm install --save fluenture +``` + +On Node 12 and up, this module can be loaded directly with `import` or +`require`. On Node versions below 12, `require` or the [esm][]-loader can +be used. + +### Deno and Modern Browsers + +You can load the EcmaScript module from various content delivery networks: + +- [Skypack](https://cdn.skypack.dev/fluenture@3.1.0) +- [JSPM](https://jspm.dev/fluenture@3.1.0) +- [jsDelivr](https://cdn.jsdelivr.net/npm/fluenture@3.1.0/+esm) + +### Old Browsers and Code Pens + +There's a [UMD][] file included in the NPM package, also available via +jsDelivr: https://cdn.jsdelivr.net/npm/fluenture@3.1.0/dist/umd.js + +This file adds `fluenture` to the global scope, or use CommonJS/AMD +when available. + +### Usage Example + ```js import {resolve, reject} from 'fluture'; import {fluent} from 'fluenture'; @@ -22,19 +50,19 @@ that were enhanced with a fluent method API. One can think of the `Fluenture` type as a *subtype* of `Future`: any instances of it are also instances of `Future`. -#### `fluent :: Future a b -⁠> Fluenture a b` +#### `fluent :: Future a b -⁠> Fluenture a b` Enhance a Future with the fluent method API. This function is idempotent. -#### `functional :: Future a b -⁠> Future a b` +#### `functional :: Future a b -⁠> Future a b` Strip a fluent Future (or "Fluenture") from its method API. This function is idempotent. -#### `pipe :: (Future a b -⁠> c) -⁠> c` +#### `pipe :: (Future a b -⁠> c) -⁠> c` This function is equivalent to Fluture's built-in `pipe` function, with once exception; If a Future is returned from the given function, it is @@ -43,88 +71,90 @@ method chain intact. Fluent [`pipe`](https://github.com/fluture-js/Fluture#pipe). -#### `alt :: Fluenture a b ~> Future a b -⁠> Fluenture a b` +#### `alt :: Fluenture a b ~> Future a b -⁠> Fluenture a b` Fluent [`alt`](https://github.com/fluture-js/Fluture#alt). -#### `and :: Fluenture a b ~> Future a b -⁠> Fluenture a b` +#### `and :: Fluenture a b ~> Future a b -⁠> Fluenture a b` Fluent [`and`](https://github.com/fluture-js/Fluture#and). -#### `ap :: Fluenture a b ~> Future a (b -⁠> c) -⁠> Fluenture a c` +#### `ap :: Fluenture a b ~> Future a (b -⁠> c) -⁠> Fluenture a c` Fluent [`ap`](https://github.com/fluture-js/Fluture#ap). -#### `bichain :: Fluenture a b ~> (a -⁠> Fluenture a c, b -⁠> Fluenture a c) -⁠> Fluenture a c` +#### `bichain :: Fluenture a b ~> (a -⁠> Fluenture a c, b -⁠> Fluenture a c) -⁠> Fluenture a c` Fluent [`bichain`](https://github.com/fluture-js/Fluture#bichain). -#### `bimap :: Fluenture a b ~> (a -⁠> c, b -⁠> d) -⁠> Fluenture c d` +#### `bimap :: Fluenture a b ~> (a -⁠> c, b -⁠> d) -⁠> Fluenture c d` Fluent [`bimap`](https://github.com/fluture-js/Fluture#bimap). -#### `both :: Fluenture a b ~> Future a c -⁠> Fluenture a (Pair b c)` +#### `both :: Fluenture a b ~> Future a c -⁠> Fluenture a (Pair b c)` Fluent [`both`](https://github.com/fluture-js/Fluture#both). -#### `cache :: Fluenture a b ~> () -⁠> Fluenture a b` +#### `cache :: Fluenture a b ~> () -⁠> Fluenture a b` Fluent [`cache`](https://github.com/fluture-js/Fluture#cache). -#### `chain :: Fluenture a b ~> (b -⁠> Fluenture a c) -⁠> Fluenture a c` +#### `chain :: Fluenture a b ~> (b -⁠> Fluenture a c) -⁠> Fluenture a c` Fluent [`chain`](https://github.com/fluture-js/Fluture#chain). -#### `chainRej :: Fluenture a b ~> (a -⁠> Fluenture c b) -⁠> Fluenture c b` +#### `chainRej :: Fluenture a b ~> (a -⁠> Fluenture c b) -⁠> Fluenture c b` Fluent [`chainRej`](https://github.com/fluture-js/Fluture#chainRej). -#### `coalesce :: Fluenture a b ~> (a -⁠> c, b -⁠> c) -⁠> Fluenture d c` +#### `coalesce :: Fluenture a b ~> (a -⁠> c, b -⁠> c) -⁠> Fluenture d c` Fluent [`coalesce`](https://github.com/fluture-js/Fluture#coalesce). -#### `lastly :: Fluenture a b ~> Future a c -⁠> Fluenture a b` +#### `lastly :: Fluenture a b ~> Future a c -⁠> Fluenture a b` Fluent [`lastly`](https://github.com/fluture-js/Fluture#lastly). -#### `map :: Fluenture a b ~> (b -⁠> c) -⁠> Fluenture a c` +#### `map :: Fluenture a b ~> (b -⁠> c) -⁠> Fluenture a c` Fluent [`map`](https://github.com/fluture-js/Fluture#map). -#### `mapRej :: Fluenture a b ~> (a -⁠> c) -⁠> Fluenture c b` +#### `mapRej :: Fluenture a b ~> (a -⁠> c) -⁠> Fluenture c b` Fluent [`mapRej`](https://github.com/fluture-js/Fluture#mapRej). -#### `pap :: Fluenture a b ~> Fluenture a (b -⁠> c) -⁠> Fluenture a c` +#### `pap :: Fluenture a b ~> Fluenture a (b -⁠> c) -⁠> Fluenture a c` Fluent [`pap`](https://github.com/fluture-js/Fluture/#pap). -#### `race :: Fluenture a b ~> Future a b -⁠> Fluenture a b` +#### `race :: Fluenture a b ~> Future a b -⁠> Fluenture a b` Fluent [`race`](https://github.com/fluture-js/Fluture#race). -#### `swap :: Fluenture a b ~> () -⁠> Fluenture b a` +#### `swap :: Fluenture a b ~> () -⁠> Fluenture b a` Fluent [`swap`](https://github.com/fluture-js/Fluture#swap). -#### `done :: Fluenture a b ~> (b -⁠> c) -⁠> Cancel` +#### `done :: Fluenture a b ~> (b -⁠> c) -⁠> Cancel` Fluent [`done`](https://github.com/fluture-js/Fluture#done). -#### `fork :: Fluenture a b ~> (a -⁠> c, b -⁠> d) -⁠> Cancel` +#### `fork :: Fluenture a b ~> (a -⁠> c, b -⁠> d) -⁠> Cancel` Fluent [`fork`](https://github.com/fluture-js/Fluture#fork). -#### `forkCatch :: Fluenture a b ~> (Error -⁠> c, a -⁠> d, b -⁠> e) -⁠> Cancel` +#### `forkCatch :: Fluenture a b ~> (Error -⁠> c, a -⁠> d, b -⁠> e) -⁠> Cancel` Fluent [`forkCatch`](https://github.com/fluture-js/Fluture#forkCatch). -#### `promise :: Fluenture Error a ~> () -⁠> Promise Error a` +#### `promise :: Fluenture Error a ~> () -⁠> Promise Error a` Fluent [`promise`](https://github.com/fluture-js/Fluture#promise). -#### `value :: Fluenture a b ~> ((Nullable a, b) -⁠> c) -⁠> Cancel` +#### `value :: Fluenture a b ~> ((Nullable a, b) -⁠> c) -⁠> Cancel` Fluent [`value`](https://github.com/fluture-js/Fluture#value). [Fluture]: https://github.com/fluture-js/Fluture +[esm]: https://github.com/standard-things/esm +[UMD]: https://github.com/umdjs/umd diff --git a/index.js b/index.js index 9f4e728..8fff784 100644 --- a/index.js +++ b/index.js @@ -18,14 +18,14 @@ //. //. You can load the EcmaScript module from various content delivery networks: //. -//. - [Skypack](https://cdn.skypack.dev/fluenture@3.0.0) -//. - [JSPM](https://jspm.dev/fluenture@3.0.0) -//. - [jsDelivr](https://cdn.jsdelivr.net/npm/fluenture@3.0.0/+esm) +//. - [Skypack](https://cdn.skypack.dev/fluenture@3.1.0) +//. - [JSPM](https://jspm.dev/fluenture@3.1.0) +//. - [jsDelivr](https://cdn.jsdelivr.net/npm/fluenture@3.1.0/+esm) //. //. ### Old Browsers and Code Pens //. //. There's a [UMD][] file included in the NPM package, also available via -//. jsDelivr: https://cdn.jsdelivr.net/npm/fluenture@3.0.0/dist/umd.js +//. jsDelivr: https://cdn.jsdelivr.net/npm/fluenture@3.1.0/dist/umd.js //. //. This file adds `fluenture` to the global scope, or use CommonJS/AMD //. when available. diff --git a/package.json b/package.json index 233f846..76836af 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "fluenture", - "version": "3.0.0", + "version": "3.1.0", "description": "Bring back Fluture's fluent method API", "keywords": [ "fluent",