fluent-interfaces
TypeScript icon, indicating that this package has built-in type declarations

1.0.1 • Public • Published

Fluent

Installation

Install via npm:

npm install fluent-interfaces

Information

Many JavaScript libraries use fluent-interfaces, but they are not at all fluent when working with 3rd party functions.

externalFunction3(
    externalFunction2(
        externalFunction1(
            new Widget()
            .setTitle("Hello World!")
            .setDescription("Welcome to my website!")
        )
    )
)

This library adds global methods for working with fluent interfaces.

import { cascade, transform } from "fluent-interfaces";

new Widget()
.setTitle("Hello World!")
.setDescription("Welcome to my website!")
[cascade](externalFunction1)
[cascade](externalFunction2)
[cascade](externalFunction3)
[cascade](self=>console.log("Created widget:", self))
// returns Widget

new Widget()
.setTitle("Hello World!")
.setDescription("Welcome to my website!")
[transform](self=>new Wrapper(self))
// returns Wrapper

License

MIT License.

All files can be used for commercial or non-commercial purposes. Do not resell. Attribution is appreciated but not due.

/fluent-interfaces/

    Package Sidebar

    Install

    npm i fluent-interfaces

    Weekly Downloads

    5

    Version

    1.0.1

    License

    MIT

    Unpacked Size

    4.04 kB

    Total Files

    5

    Last publish

    Collaborators

    • cymaera