Skip to content

Commit

Permalink
Updated: Slight improvement to internal xwrap function
Browse files Browse the repository at this point in the history
  • Loading branch information
dhershman1 committed Sep 24, 2024
1 parent ed6d0f0 commit 2f54703
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions src/_internals/_xwrap.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,10 @@
* @param {Function} fn The function to wrap
* @return {Object} The wrapped function
*/
const _xwrap = fn => ({
'@@transducer/result': acc => acc,
'@@transducer/step': fn
})

export default _xwrap
export default function _xwrap (fn) {
return {
'@@transducer/init': () => { throw new Error('init not implemented on XWrap') },
'@@transducer/result': acc => acc,
'@@transducer/step': (acc, x) => fn(acc, x)
}
}

0 comments on commit 2f54703

Please sign in to comment.