An open API service indexing awesome lists of open source software.

https://github.com/a-x-/dfltv

default value wrapper
https://github.com/a-x-/dfltv

Last synced: 3 months ago
JSON representation

default value wrapper

Awesome Lists containing this project

README

        

# dfltv
default value wrapper

if value is not defined or it matches with a pattern then it subtitutes with default value
else passes as is

### using
```es6
import Dflt from 'dflt'
const dflt = Dflt('oh fuck', 'oh god')
// ^ pattern ^ default
const bazquxval = fetchBazQux(/*...*/)
foobar(dflt(bazquxval)) // if bazquxval equals 'oh fuck' or not bazquxval: 'oh god' else bazquxval
// ...
```