Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up

Bring back Fluture's fluent method API

License

NotificationsYou must be signed in to change notification settings

fluture-js/fluenture

Repository files navigation

Brings backFluture'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 withimport orrequire. On Node versions below 12,require or theesm-loader canbe used.

Deno and Modern Browsers

You can load the EcmaScript module from various content delivery networks:

Old Browsers and Code Pens

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.

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


[8]ページ先頭

©2009-2025 Movatter.jp