wix-incubator / react-templates

Light weight templates for react
https://wix.github.io/react-templates
MIT License
2.82k stars 206 forks source link

rt-class doesn't work with lodash 4.5.0 #105

Closed shaylh closed 8 years ago

shaylh commented 8 years ago

Looks like lodash's implementation of "_.pick" changed in 4.5.0, and now

_.pick({ foo: true }, _.identity)

returns an empty object.

Codepen example with lodash 3.10.0 Codepen example with lodash 4.5.0

:)

nippur72 commented 8 years ago

don't know how pick is used in rt, but perhaps it's enough to replace it with pickBy ?

Codepen with _.pickBy

shaylh commented 8 years ago

Unfortunately no, because _.pickBy was only introduced in lodash 4.5.0.

nippur72 commented 8 years ago

I mean, is the new pickBy equivalent to the old pick ? If so, at we could a switch or something like that.

nippur72 commented 8 years ago

any ideas about how to solve this issue? Today I spent a long time debugging why my classes weren't working ...

shaylh commented 8 years ago

_({foo: true, bar: false}).transform(function(res, value, key){ if(value){ res.push(key); } }, []).value().join(' ');

A bit ugly, I guess it could be improved, though it does the work on both lodash versions :)

sergio11 commented 8 years ago

I have the same problem. Could you close the issue? please :)

shaylh commented 8 years ago

@mariawix , can you please also update the NPM repository? :)