Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@orther
Last active December 15, 2017 01:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save orther/ab5e5cff7246f05989d4a52de7ddcbe4 to your computer and use it in GitHub Desktop.
Save orther/ab5e5cff7246f05989d4a52de7ddcbe4 to your computer and use it in GitHub Desktop.
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