Skip to content

Commit

Permalink
fix(): apply toString() instead of ramda toString.
Browse files Browse the repository at this point in the history
  • Loading branch information
wcastand committed Oct 4, 2016
1 parent 842c1ac commit 16074a1
Showing 1 changed file with 15 additions and 11 deletions.
26 changes: 15 additions & 11 deletions src/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,23 @@ const createState = (metadata, f) => {
const deleteMode = R.omit(['mode'])
const deleteNext = R.omit(['next'])
const deletePrevious = R.omit(['previous'])
const stringifyContents = R.over(R.lensProp('contents'), R.toString)
const stringifyContents = R.over(R.lensProp('contents'), x => x.toString())

const cleanMetadata = R.curry((obj) => {
const test = R.ifElse(
R.hasIn('contents'),
R.compose(
deletePrevious,
deleteNext,
deleteMode,
deleteStat,
stringifyContents),
cleanMetadata
)
const test = (val) => {
return R.is(Object, val)
? R.ifElse(
R.hasIn('contents'),
R.compose(
deletePrevious,
deleteNext,
deleteMode,
deleteStat,
stringifyContents),
cleanMetadata
)
: val
}
return R.map(test, obj)
})
const state = { metadata: cleanMetadata(metadata) }
Expand Down

0 comments on commit 16074a1

Please sign in to comment.