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
- Host: GitHub
- URL: https://github.com/a-x-/dfltv
- Owner: a-x-
- License: mit
- Created: 2016-08-20T16:23:50.000Z (almost 9 years ago)
- Default Branch: master
- Last Pushed: 2016-08-20T16:37:32.000Z (almost 9 years ago)
- Last Synced: 2024-04-14T11:57:01.685Z (about 1 year ago)
- Language: JavaScript
- Homepage: https://www.npmjs.com/package/dfltv
- Size: 3.91 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# dfltv
default value wrapperif 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
// ...
```