7.3.6 • Published 3 years ago

@berun/fluent v7.3.6

Weekly downloads
55
License
MPL-2.0
Repository
github
Last release
3 years ago

@berun/fluent

Use a chaining API to generate and simplify the modification of front end build and development configurations.

_Note: This is just a thin wrapper around webpack-chain with just the core fluent (chainable) maps and sets included, to enable the development of a fluent interface for any such tool, not just webpack.

FluentMap

One of the core API interfaces in @berun/fluent is a FluentMap. A FluentMap operates similar to a JavaScript Map, with some conveniences for chaining and generating configuration. If a property is marked as being a FluentMap, it will have an API and methods as described below:

Unless stated otherwise, these methods will return the FluentMap, allowing you to chain these methods.

// Remove all entries from a Map.
clear()
// Remove a single entry from a Map given its key.
// key: *
delete key
// Fetch the value from a Map located at the corresponding key.
// key: *
// returns: value
get(key)
// Set a value on the Map stored at the `key` location.
// key: *
// value: *
set(key, value)
// Returns `true` or `false` based on whether a Map as has a value set at a particular key.
// key: *
// returns: Boolean
has(key)
// Returns an array of all the values stored in the Map.
// returns: Array
values()
// Returns an object of all the entries in the backing Map
// where the key is the object property, and the value
// corresponding to the key. Will return `undefined` if the backing
// Map is empty.
// This will order properties by their name if the value is
// a FluentMap that used .before() or .after().
// returns: Object, undefined if empty
entries()
// Provide an object which maps its properties and values
// into the backing Map as keys and values.
// You can also provide an array as the second argument
// for property names to omit from being merged.
// obj: Object
// omit: Optional Array
merge(obj, omit)
// Execute a function against the current configuration context
// handler: Function -> FluentMap
// A function which is given a single argument of the FluentMap instance
batch(handler)
// Conditionally execute a function to continue configuration
// condition: Boolean
// whenTruthy: Function -> FluentMap
// invoked when condition is truthy, given a single argument of the FluentMap instance
// whenFalsy: Optional Function -> FluentMap
// invoked when condition is falsy, given a single argument of the FluentMap instance
when(condition, whenTruthy, whenFalsy)

FluentSet

Another of the core API interfaces in BeRun Fluentis a FluentSet. A FluentSet operates similar to a JavaScript Set, with some conveniences for chaining and generating configuration. If a property is marked as being a FluentSet, it will have an API and methods as described below:

Unless stated otherwise, these methods will return the FluentSet, allowing you to chain these methods.

// Add/append a value to the end of a Set.
// value: *
add(value)
// Add a value to the beginning of a Set.
// value: *
prepend(value)
// Remove all values from a Set.
clear()
// Remove a specific value from a Set.
// value: *
delete value
// Returns `true` or `false` based on whether or not the
// backing Set contains the specified value.
// value: *
// returns: Boolean
has(value)
// Returns an array of values contained in the backing Set.
// returns: Array
values()
// Concatenates the given array to the end of the backing Set.
// arr: Array
merge(arr)
// Execute a function against the current configuration context
// handler: Function -> FluentSet
// A function which is given a single argument of the FluentSet instance
batch(handler)
// Conditionally execute a function to continue configuration
// condition: Boolean
// whenTruthy: Function -> FluentSet
// invoked when condition is truthy, given a single argument of the FluentSet instance
// whenFalsy: Optional Function -> FluentSet
// invoked when condition is falsy, given a single argument of the FluentSet instance
when(condition, whenTruthy, whenFalsy)
7.3.1

3 years ago

7.3.5

3 years ago

7.3.2

3 years ago

7.3.6

3 years ago

7.0.0

3 years ago

7.0.3

3 years ago

7.0.2

3 years ago

7.0.1

3 years ago

3.0.21

3 years ago

3.2.3

3 years ago

3.1.1

3 years ago

3.1.0

3 years ago

3.0.23

4 years ago

3.0.24

4 years ago

3.0.22

4 years ago

3.0.20

4 years ago

3.0.18

4 years ago

3.0.19

4 years ago

3.0.17

4 years ago

3.0.16

4 years ago

3.0.15

4 years ago

3.0.14

4 years ago

3.0.12

4 years ago

3.0.13

4 years ago

3.0.9

4 years ago

3.0.10

4 years ago

3.0.11

4 years ago

3.0.7

4 years ago

3.0.4

4 years ago

3.0.3

4 years ago

3.0.6

4 years ago

3.0.5

4 years ago

2.2.2

5 years ago

2.2.1

5 years ago

2.1.6

5 years ago

2.1.3

5 years ago

2.1.0

5 years ago

2.0.23

5 years ago

2.0.22

5 years ago

2.0.21

5 years ago

2.0.20

5 years ago

2.0.19

5 years ago

2.0.18

5 years ago

2.0.16

5 years ago

2.0.14

5 years ago

2.0.13

6 years ago

2.0.10

6 years ago

2.0.9

6 years ago

2.0.8

6 years ago

2.0.7

6 years ago

2.0.6

6 years ago

2.0.5

6 years ago

2.0.4

6 years ago

2.0.3

6 years ago

2.0.2

6 years ago

2.0.1

6 years ago