webpack-super
a functional approach to writing webpack configs
Installation
npm install webpack-super --save
Functions
- appendAt(path, value, obj) ⇒
object
- compose(...funcs) ⇒
function
- copy(path, source, destination) ⇒
object
- setAt(path, value, obj) ⇒
object
- when(condition, func) ⇒
function
object
appendAt(path, value, obj) ⇒ Creates a new object with the value set at the path provided and copy the rest.
Kind: global function
Implements: Transformer
Param | Type | Description |
---|---|---|
path | string |
path string where the value needs to be set |
value | any |
the value that needs to be set |
obj | object |
the object that needs to be transformed |
function
compose(...funcs) ⇒ Creates a composition factory functions
Kind: global function
Implements: Helper
Param | Type | Description |
---|---|---|
...funcs | function |
factory functions |
object
copy(path, source, destination) ⇒ Copies a value at a path
from source
to destination
Kind: global function
Implements: Transformer
Param | Type | Description |
---|---|---|
path | string |
path string where the value needs to be picked/set |
source | object |
source object from where the value needs to be picked |
destination | object |
destination object where the value needs to be set |
Example
// outputs: {a: {b: 100}, q: 100}
object
setAt(path, value, obj) ⇒ Creates a new object with the value
set at the path
provided and copy the rest.
Kind: global function
Implements: Transformer
Returns: object
- the new object with the value
Param | Type | Description |
---|---|---|
path | string |
path string where the value needs to be set |
value | any |
the value that needs to be set |
obj | object |
the object that needs to be transformed |
Example
// outputs: {entry: './src/main.js'} // outputs: {output: {filename: '[hash].bundle.js'}}
function
when(condition, func) ⇒ Returns a new function that is either has no effect (identity) or
or has the same as the passed func
based on the condition
.
Kind: global function
Implements: Transformer
Param | Type | Description |
---|---|---|
condition | boolean |
the condition |
func | function |
the function to be called |