1.0.4 • Published 5 years ago

fluent-interface-example v1.0.4

Weekly downloads
-
License
ISC
Repository
-
Last release
5 years ago

Fluent Interface Example

A fluent interface is a form of an API that allows chaining methods to simplify common activities, especially where multiple operations are executed or options are specified in series.

Ideally fluent interfaces should only be employed where readability is improved when the API is frequently leveraged as a series of combined actions.

Common examples of Fluent Interfaces are:

jQuery

$('.mySelector')
    .hide()
    .addClass('anotherClass')
    .show();
    

Request

request
  .get('http://google.com/img.png')
  .on('response', function(response) {
    console.log(response.statusCode) // 200
    console.log(response.headers['content-type']) // 'image/png'
  })
  .pipe(request.put('http://mysite.com/img.png'))
  

Installation

# npm install -g fluent-interface-example
      

Usage

Follow installation instructions above to install the unit-convert tool globally.

Convert millimetres to feet

# unit-convert --convert 100 --from mm --to ft

Convert celsius to fahrenheit

# unit-convert --convert 100 --from C --to F

Show all possible conversion units

# unit-convert --possibilities

Show all possible conversion units from a particular unit

# unit-convert --possibilities --from C

Running tests

# npm run test

Releasing

This repository leverages git-flow (AVH) for its branding and merging strategy. Releasing is automated via the generate-release tool.

Update patch version:

# npm run patch

Update minor version:

# npm run release    
1.0.4

5 years ago

1.0.3

5 years ago

1.0.2

5 years ago

1.0.1

5 years ago