2.0.0 • Published 8 years ago

webpack-super v2.0.0

Weekly downloads
2
License
MIT
Repository
github
Last release
8 years ago

webpack-super

Build Status npm Coverage Status Donate Bitcoin

a functional approach to writing webpack configs

Installation

npm install webpack-super --save

Functions

appendAt(path, value, obj) ⇒ object

Creates a new object with the value set at the path provided and copy the rest.

Kind: global function
Implements: Transformer

ParamTypeDescription
pathstringpath string where the value needs to be set
valueanythe value that needs to be set
objobjectthe object that needs to be transformed

compose(...funcs) ⇒ function

Creates a composition factory functions

Kind: global function
Implements: Helper

ParamTypeDescription
...funcsfunctionfactory functions

copy(path, source, destination) ⇒ object

Copies a value at a path from source to destination

Kind: global function
Implements: Transformer

ParamTypeDescription
pathstringpath string where the value needs to be picked/set
sourceobjectsource object from where the value needs to be picked
destinationobjectdestination object where the value needs to be set

Example

copy('a.b', {a: {b: 100}}, {p: 100}) // outputs: {a: {b: 100}, q: 100}

setAt(path, value, obj) ⇒ object

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

ParamTypeDescription
pathstringpath string where the value needs to be set
valueanythe value that needs to be set
objobjectthe object that needs to be transformed

Example

setAt('entry', './src/main.js', {}) // outputs: {entry: './src/main.js'}
setAt('output.filename', '[hash].bundle.js', {}) // outputs: {output: {filename: '[hash].bundle.js'}}

when(condition, func) ⇒ function

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

ParamTypeDescription
conditionbooleanthe condition
funcfunctionthe function to be called
2.0.0

8 years ago

1.1.0

8 years ago

1.0.0

8 years ago