npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

fluenture

v3.1.0

Published

Bring back Fluture's fluent method API

Downloads

80

Readme

Fluenture

Brings back Fluture's fluent method API, for the nostalgic developer.

Usage

Node

$ 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:

Old Browsers and Code Pens

There's a UMD file included in the NPM package, also available via jsDelivr: https://cdn.jsdelivr.net/npm/[email protected]/dist/umd.js

This file adds fluenture to the global scope, or use CommonJS/AMD when available.

Usage Example

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)

API

We're using the Fluenture a b type here to denote instances of Future 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

Enhance a Future with the fluent method API.

This function is idempotent.

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

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 automatically wrapped using fluent, so as to keep the fluent method chain intact.

Fluent pipe.

alt :: Fluenture a b ~> Future a b -⁠> Fluenture a b

Fluent alt.

and :: Fluenture a b ~> Future a b -⁠> Fluenture a b

Fluent and.

ap :: Fluenture a b ~> Future a (b -⁠> c) -⁠> Fluenture a c

Fluent ap.

bichain :: Fluenture a b ~> (a -⁠> Fluenture a c, b -⁠> Fluenture a c) -⁠> Fluenture a c

Fluent bichain.

bimap :: Fluenture a b ~> (a -⁠> c, b -⁠> d) -⁠> Fluenture c d

Fluent bimap.

both :: Fluenture a b ~> Future a c -⁠> Fluenture a (Pair b c)

Fluent both.

cache :: Fluenture a b ~> () -⁠> Fluenture a b

Fluent cache.

chain :: Fluenture a b ~> (b -⁠> Fluenture a c) -⁠> Fluenture a c

Fluent chain.

chainRej :: Fluenture a b ~> (a -⁠> Fluenture c b) -⁠> Fluenture c b

Fluent chainRej.

coalesce :: Fluenture a b ~> (a -⁠> c, b -⁠> c) -⁠> Fluenture d c

Fluent coalesce.

lastly :: Fluenture a b ~> Future a c -⁠> Fluenture a b

Fluent lastly.

map :: Fluenture a b ~> (b -⁠> c) -⁠> Fluenture a c

Fluent map.

mapRej :: Fluenture a b ~> (a -⁠> c) -⁠> Fluenture c b

Fluent mapRej.

pap :: Fluenture a b ~> Fluenture a (b -⁠> c) -⁠> Fluenture a c

Fluent pap.

race :: Fluenture a b ~> Future a b -⁠> Fluenture a b

Fluent race.

swap :: Fluenture a b ~> () -⁠> Fluenture b a

Fluent swap.

done :: Fluenture a b ~> (b -⁠> c) -⁠> Cancel

Fluent done.

fork :: Fluenture a b ~> (a -⁠> c, b -⁠> d) -⁠> Cancel

Fluent fork.

forkCatch :: Fluenture a b ~> (Error -⁠> c, a -⁠> d, b -⁠> e) -⁠> Cancel

Fluent forkCatch.

promise :: Fluenture Error a ~> () -⁠> Promise Error a

Fluent promise.

value :: Fluenture a b ~> ((Nullable a, b) -⁠> c) -⁠> Cancel

Fluent value.