Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

invokeMap in fp strange behavior #3883

Closed
JesterXL opened this Issue Jul 24, 2018 · 3 comments

Comments

2 participants
@JesterXL
Copy link

JesterXL commented Jul 24, 2018

The 2nd example for invokeMap fp don't seem to work, but they work with regular lodash. Using v4.17.4 in Node 10.1.0 and tested in Chrome 67.0.3396.99 on Stackblitz. I'm having various challenges getting it to pass values to functions, so am wondering if this is related?

Regular Lodash:

// works
_.invokeMap([[5, 1, 7], [3, 2, 1]], 'sort')
// [[1, 5, 7], [1, 2, 3]]

// works
_.invokeMap([123, 456], String.prototype.split, '')
// [[1, 5, 7], [1, 2, 3]]

FP Lodash:

// works
invokeMap('sort', [[5, 1, 7], [3, 2, 1]])
// [[1, 5, 7], [1, 2, 3]]

// fails
log(invokeMap([String.prototype.split, ''], [123, 456]))
// [undefined, undefined]
@JesterXL

This comment has been minimized.

Copy link
Author

JesterXL commented Jul 24, 2018

Just checked, and it seems invoke has the same issue. I'm referring to these unofficial docs: https://gist.github.com/jfmengels/6b973b69c491375117dc

@jdalton jdalton added the question label Jul 24, 2018

@jdalton

This comment has been minimized.

Copy link
Member

jdalton commented Jul 24, 2018

Hi @JesterXL!

The fp invokeMap method variant has a fixed arity of 2 (so no args param). We don't currently provide an invokeMapArgs form, however you can use convert to reconfigure it.

@jdalton jdalton closed this Jul 24, 2018

@JesterXL

This comment has been minimized.

Copy link
Author

JesterXL commented Jul 24, 2018

Ah, makes total sense, ok cool, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.