-
Notifications
You must be signed in to change notification settings - Fork 7.1k
Closed
oisinf/ModernReactWithRedux
#1Labels
Description
When using convert
on functions from lodash fp, they seem to lose their support for using _
as a placeholder. If I explicitly call curry
on the result, they regain their placeholder support. Here's a full test case showing a failing test:
import _ from 'lodash/fp'
describe('lodash test', () => {
it('placeholder for converted functions', () => {
let mutableUnset = _.unset.convert({ immutable: false })
let x = {
a: 1,
b: 1
}
console.log(mutableUnset.placeholder) // <-- Seems to be lodash
console.log(mutableUnset.placeholder == _) // <-- false
let unsetInX = mutableUnset(_, x)
unsetInX('a') // <--- throws `TypeError: unsetInX is not a function`
console.log(x)
})
it('placeholder for explicitly curried converted functions', () => {
let mutableUnset = _.curryN(2, _.unset.convert({ immutable: false }))
let x = {
a: 1,
b: 1
}
console.log(mutableUnset.placeholder) // <-- Seems to be lodash
console.log(mutableUnset.placeholder == _) // <-- true
let unsetInX = mutableUnset(_, x)
unsetInX('a') // <--- works because of the explicit curry above
console.log(x) // { b: 1}
})
})