8000 FP version of update does not work on function properties · Issue #3219 · lodash/lodash · GitHub
[go: up one dir, main page]

Skip to content

FP version of update does not work on function properties #3219

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

Closed
mewdriller opened this issue Jun 22, 2017 · 3 comments
Closed

FP version of update does not work on function properties #3219

mewdriller opened this issue Jun 22, 2017 · 3 comments

Comments

@mewdriller
Copy link

Expected Behavior

Calling update on a key-path that resolves to a function causes the updater to be passed the function.

Observed Behavior

Calling update on a key-path that resolves to a function causes the updater to be passed undefined.

Steps to Reproduce

import { update } from 'lodash/fp';

const obj = { a: 1, b: n => n * 2 };

console.log(obj.b(2)); // 4

const updatedObj = update('b', fn => n => fn(n) + 1, obj);

console.log(updatedObj.b(2)); // TypeError: fn is not a function

Notes

For comparison, this works in the normal version of lodash:

import { update } from 'lodash';

const obj = { a: 1, b: n => n * 2 };

console.log(obj.b(2)); // 4

update(obj, 'b', fn => n => fn(n) + 1);

console.log(obj.b(2)); // 5
@jdalton
Copy link
Member
jdalton commented Jun 22, 2017

Hi @mewdriller!

Dup of #3203.

@jdalton jdalton closed this as completed Jun 22, 2017
@mewdriller
Copy link
Author

Whoops! Sorry I missed that before opening this one. Glad to hear it's taken care of already @jdalton.

@lock
Copy link
lock bot commented Dec 27, 2018

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@lock lock bot locked as resolved and limited conversation to collaborators Dec 27, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Development

No branches or pull requests

2 participants
0