1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | 1× 1× 4× 1× 3× 1× | // TODO: write tests/flow annotations import R from 'ramda'; import { INPUT_PROPS, META_PROPS, IGNORE_PROPS } from './consts'; const maybeCheckProps = all => { if (typeof all.value === 'boolean') { return R.merge(all, { checked: all.value }); } return all; }; const separateProps = all => ({ input: R.pick(INPUT_PROPS, all), meta: R.pick(META_PROPS, all), custom: R.omit(IGNORE_PROPS, all), }); // Order matters! // Separate always last export default R.compose(separateProps, maybeCheckProps); |