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

createTransformer does not support transformer function that has an argument with a default value (ES6) #698

Closed
timmolendijk opened this issue Dec 6, 2016 · 1 comment
Labels

Comments

@timmolendijk
Copy link

timmolendijk commented Dec 6, 2016

createTransformer takes a transformer argument, which is expected to be a function that takes precisely one argument. MobX tries to test this requirement by checking that transformer.length === 1.

The problem though is that this will break in the case of functions that have an argument with a default value, because those will have length === 0 (at least in Node 5 and in latest Google Chrome).

For example, this breaks (and unnecessarily so as far as I can see):

const slice = createTransformer((data = []) => data.slice(0, 5));
@mweststrate
Copy link
Member

Closed as the fix will be part of the upcoming 3.0 release

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants