Skip to content

TheCymaera/fluent-interfaces

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published