Skip to content

Latest commit

 

History

History
15 lines (13 loc) · 410 Bytes

README.md

File metadata and controls

15 lines (13 loc) · 410 Bytes

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

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
// ...