Last active
December 15, 2017 01:57
-
-
Save orther/ab5e5cff7246f05989d4a52de7ddcbe4 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import R from 'ramda'; | |
import RA from 'ramda-adjunct'; | |
const isNonEmptyString = R.both(RA.isString, RA.isNotEmpty); | |
const hasDriverDetail = R.compose( | |
R.any(isNonEmptyString), | |
R.props([ | |
'customDriverPhone', | |
'customDriverName', | |
'customDriverCarLicense', | |
'customDriverCarDescription', | |
]), | |
); | |
// Usage: | |
// hasDriverDetail({customDriverName: ''}); //=> false | |
// hasDriverDetail({customDriverName: undefined}); //=> false | |
// hasDriverDetail({customDriverName: 'Ben'}); //=> True |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment