Skip to content

Instantly share code, notes, and snippets.

@variousauthors
Forked from austin-sa-wang/a.js
Last active November 15, 2018 20:01
Show Gist options
  • Save variousauthors/bbf084aa70b09da11d71f4d66bc95b33 to your computer and use it in GitHub Desktop.
Save variousauthors/bbf084aa70b09da11d71f4d66bc95b33 to your computer and use it in GitHub Desktop.
serialization different function formation
const serializePackageItem = R.pick([
'offeringOptions',
'offeringId',
'offeringPackageOptionId',
'durationAmount',
'durationTypeId',
'startDate',
'selectedPackageOptionItems'
])
const omitOfferings = overProp('selectedPackageOptionItems', R.map(R.ommit('offering')))
const whenHasPackageItems = R.when(R.has('selectedPackageOptionItems'))
const serializePackageItems = R.compose(
whenHasPackageItems(omitOfferings),
serializePackageItem
)
const serializeOfferingOptionsFields = overProp('offeringOptions', R.map(serializePackageItems))
const serializePreviewFilter = R.compose(
serializeOfferingOptionsFields,
addMinMaxAge,
addCustomItems,
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment