Skip to content

Instantly share code, notes, and snippets.

@austin-sa-wang
Created November 15, 2018 19:36
Show Gist options
  • Save austin-sa-wang/ca5639ac7d57c44b6ba9297db3057346 to your computer and use it in GitHub Desktop.
Save austin-sa-wang/ca5639ac7d57c44b6ba9297db3057346 to your computer and use it in GitHub Desktop.
serialization different function formation
const serializeOfferingOptions = R.map(R.compose(
R.pick([
'offeringOptions',
'offeringId',
'offeringPackageOptionId',
'durationAmount',
'durationTypeId',
'startDate',
'selectedPackageOptionItems'
]),
R.when(R.has('selectedPackageOptionItems'),
overProp('selectedPackageOptionItems', R.map(R.omit('offering')))
)
))
const serializePreviewFilter = R.compose(
overProp('offeringOptions', serializeOfferingOptions),
addMinMaxAge,
addCustomItems,
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment