Socket
Socket
Sign inDemoInstall

fluture

Package Overview
Dependencies
Maintainers
3
Versions
109
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

fluture - npm Package Compare versions

Comparing version 12.3.0 to 12.3.1

6

package.json
{
"name": "fluture",
"version": "12.3.0",
"version": "12.3.1",
"description": "FantasyLand compliant (monadic) alternative to Promises",

@@ -67,2 +67,4 @@ "main": "index.cjs",

"devDependencies": {
"@rollup/plugin-commonjs": "^13.0.0",
"@rollup/plugin-node-resolve": "^8.0.1",
"c8": "^7.0.0",

@@ -82,4 +84,2 @@ "chai": "^4.1.2",

"rollup": "^2.0.0",
"rollup-plugin-commonjs": "^10.0.2",
"rollup-plugin-node-resolve": "^5.2.0",
"sanctuary-benchmark": "^1.0.0",

@@ -86,0 +86,0 @@ "sanctuary-either": "^2.0.0",

@@ -38,6 +38,31 @@ # [![Fluture](logo.png)](#butterfly)

## Installation
### With NPM
```console
$ npm install --save fluture
```
### Bundled from a CDN
To load Fluture directly into a browser, a code pen, or [Deno][], use one of
the following downloads from the JSDelivr content delivery network. These are
single files that come with all of Fluture's dependencies pre-bundled.
- [Fluture Script][]: A JavaScript file that adds `Fluture` to the global
scope. Ideal for older browsers and code pens.
- [Fluture Script Minified][]: The same as above, but minified.
- [Fluture Module][]: An EcmaScript module with named exports. Ideal for Deno
or modern browsers.
- [Fluture Module Minified][]: A minified EcmaScript module without TypeScript
typings. Not recommended for Deno.
[Fluture Script]: https://cdn.jsdelivr.net/gh/fluture-js/Fluture@12.3.1/dist/bundle.js
[Fluture Script Minified]: https://cdn.jsdelivr.net/gh/fluture-js/Fluture@12.3.1/dist/bundle.min.js
[Fluture Module]: https://cdn.jsdelivr.net/gh/fluture-js/Fluture@12.3.1/dist/module.js
[Fluture Module Minified]: https://cdn.jsdelivr.net/gh/fluture-js/Fluture@12.3.1/dist/module.min.js
## Usage
> `npm install --save fluture`
### EcmaScript Module

@@ -47,13 +72,13 @@

- On Node 13 and up, you can load Fluture directly as shown in the example.
- On Node 12, you'll need to run with `node --experimental-modules`.
- On Node versions below 12, you can use the [esm loader][esm]. Alternatively,
you can use the [CommonJS Module](#commonjs-module).
- On Node 13 and up, Fluture can be loaded directly as shown in the example.
- On Node 12, the `--experimental-modules` flag must be provided.
- On Node versions below 12, the [esm loader][esm] can be used. Alternatively,
there is a [CommonJS Module](#commonjs-module) available.
- Modern browsers can run Fluture directly. If you'd like to try this out,
I recommend installing Fluture with [Pika][] or [Snowpack][]. You can also
try the [bundled module](#global-bundle-cdn) to avoid a package manager.
- For older browsers, you can use a bundler such as [Rollup][] or WebPack.
Fluture doesn't use ES5+ language features, so the source does not have to
be transpiled. Alternatively, you can use the
[CommonJS Module](#commonjs-module).
try the [bundled module](#bundled-from-a-cdn) to avoid a package manager.
- For older browsers, use a bundler such as [Rollup][] or WebPack. Besides the
module system, Fluture uses purely ES5-compatible syntax, so the source does
not have to be transpiled after bundling. Alternatively, there is a
[CommonJS Module](#commonjs-module) available.

@@ -74,20 +99,2 @@ ```js

### Global Bundle (CDN)
To load Fluture directly into a browser, a code pen, or [Deno][], use one of
the following downloads from JSDelivr. They are single files that come with all
of Fluture's dependencies pre-bundled.
- [Fluture Script][]: A JavaScript file that adds `Fluture` to the global
scope. Ideal for older browsers and code pens.
- [Fluture Script Minified][]: The same as above, but minified.
- [Fluture Module][]: An EcmaScript module with named exports. Ideal for Deno
or modern browsers.
- [Fluture Module Minified][]: A minified EcmaScript module without TypeScript typings. Not recommended for Deno.
[Fluture Script]: https://cdn.jsdelivr.net/gh/fluture-js/Fluture@12.3.0/dist/bundle.js
[Fluture Script Minified]: https://cdn.jsdelivr.net/gh/fluture-js/Fluture@12.3.0/dist/bundle.min.js
[Fluture Module]: https://cdn.jsdelivr.net/gh/fluture-js/Fluture@12.3.0/dist/module.js
[Fluture Module Minified]: https://cdn.jsdelivr.net/gh/fluture-js/Fluture@12.3.0/dist/module.min.js
### CommonJS Module

@@ -98,4 +105,4 @@

On older environments you may need to polyfill one or more of the following
functions: [`Object.create`][JS:Object.create],
On older environments one or more of the following functions may need to be
polyfilled: [`Object.create`][JS:Object.create],
[`Object.assign`][JS:Object.assign] and [`Array.isArray`][JS:Array.isArray].

@@ -117,25 +124,2 @@

## Interoperability
[<img src="https://raw.github.com/fantasyland/fantasy-land/master/logo.png" align="right" width="82" height="82" alt="Fantasy Land" />][FL]
* `Future` implements [Fantasy Land][FL] 1.0+ -compatible
`Alt`, `Bifunctor`, `Monad`, and `ChainRec`
(`of`, `ap`, `alt`, `map`, `bimap`, `chain`, `chainRec`).
* `Future.Par` implements [Fantasy Land 3][FL] -compatible
`Alternative` (`of`, `zero`, `map`, `ap`, `alt`).
* The Future and ConcurrentFuture representatives contain `@@type` properties
for [Sanctuary Type Identifiers][STI].
* The Future and ConcurrentFuture instances contain `@@show` properties for
[Sanctuary Show][SS].
## Butterfly
The name "Fluture" is a conjunction of "FL" (the acronym to [Fantasy Land][FL])
and "future". Fluture means butterfly in Romanian: A creature one might expect
to see in Fantasy Land.
Credit goes to Erik Fuente for styling the logo, and [WEAREREASONABLEPEOPLE][9]
for sponsoring the project.
## Documentation

@@ -147,2 +131,6 @@

- [Installation instructions](#installation)
- [Usage instructions](#usage)
- [About the Fluture project](#butterfly)
- [On interoperability with other libraries](#interoperability)
- [How to read the type signatures](#type-signatures)

@@ -154,3 +142,3 @@ - [How cancellation works](#cancellation)

- [Usage with Sanctuary](#sanctuary)
- [Using multiple versions of Fluture](#casting-futures)
- [Using multiple versions of Fluture alongside each other](#incompatible-fluture-versions)

@@ -251,2 +239,25 @@ </details>

### Butterfly
The name "Fluture" is a conjunction of "FL" (the acronym to [Fantasy Land][FL])
and "future". Fluture means butterfly in Romanian: A creature one might expect
to see in Fantasy Land.
Credit goes to Erik Fuente for styling the logo, and [WEAREREASONABLEPEOPLE][9]
for sponsoring the project.
### Interoperability
[<img src="https://raw.github.com/fantasyland/fantasy-land/master/logo.png" align="right" width="82" height="82" alt="Fantasy Land" />][FL]
* `Future` implements [Fantasy Land][FL] 1.0+ -compatible
`Alt`, `Bifunctor`, `Monad`, and `ChainRec`
(`of`, `ap`, `alt`, `map`, `bimap`, `chain`, `chainRec`).
* `Future.Par` implements [Fantasy Land 3][FL] -compatible
`Alternative` (`of`, `zero`, `map`, `ap`, `alt`).
* The Future and ConcurrentFuture representatives contain `@@type` properties
for [Sanctuary Type Identifiers][STI].
* The Future and ConcurrentFuture instances contain `@@show` properties for
[Sanctuary Show][SS].
### Type signatures

@@ -278,3 +289,4 @@

- **Future** - Instances of Future provided by [compatible versions](#casting-futures) of Fluture.
- **Future** - Instances of Future provided by
[compatible versions](#incompatible-fluture-versions) of Fluture.
- **ConcurrentFuture** - Futures wrapped with ([`Future.Par`](#concurrentfuture)).

@@ -530,21 +542,29 @@ - **Promise a b** - Values which conform to the [Promises/A+ specification][7]

### Casting Futures
### Incompatible Fluture Versions
Sometimes we may need to convert one Future to another, for example when the
Future was created by another package, or an incompatible version of Fluture.
Most versions of Fluture understand how to consume instances from most other
versions, even across Fluture's major releases. This allows for different
packages that depend on Fluture to interact.
When [`isFuture`](#isfuture) returns `false`, a conversion is necessary.
Usually the most concise way of doing this is as follows:
However, sometimes it's unavoidable that a newer version of Fluture is released
that can no longer understand older versions, and vice-versa. This only ever
happens on a major release, and will be mentioned in the breaking change log.
When two incompatible versions of Fluture meet instances, they do their best to
issue a clear error message about it.
When this happens, you need to manually convert the older instance to a newer
instance of Future. When [`isFuture`](#isfuture) returns `false`, a conversion
is necessary. You can also apply this trick if the Future comes from another
library similar to Fluture.
```js
> const NoFuture = require ('incompatible-future')
const NoFuture = require ('incompatible-future')
> const incompatible = NoFuture.of ('Hello')
const incompatible = NoFuture.of ('Hello')
> const compatible = Future (incompatible.fork.bind (incompatible))
const compatible = Future ((rej, res) => {
return NoFuture.fork (rej) (res) (incompatible)
})
> fork (log ('rejection'))
. (log ('resolution'))
. (both (compatible) (resolve ('world')))
[resolution]: ["Hello", "world"]
both (compatible) (resolve ('world'))
```

@@ -551,0 +571,0 @@

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc