-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
coerce arguments order is incorrect #2152
Comments
I'm not sure I understand the relationship with v15 but documentation is now fixed. |
Thanks. Edited the title to avoid ambiguity. I'm also a bit confused relating to another issue with same ...
coerce: {
from: 'string',
method(value) {
if (isString(value)) {
// Strip out any non-numeric characters (eg. ,) but keep decimal points
return { value: value.replace(/[^0-9.]/g, '') };
}
return { value };
}
} Am I missing something @Marsup ? |
You should use prepare for that. Same as your 1st try but |
This thread has been automatically locked due to inactivity. Please open a new issue for related bugs or questions following the new issue template instructions. |
Context
What are you trying to achieve or the steps to reproduce ?
Following the new doc for extensions and some examples in the release notes, I'm trying to coerce values as shown in the below example.
The issue is that, the order of the arguments seems to be wrong. It says its supposed to
coerce(schema, value, helpers)
but what I actually get iscoerce(value, schema, ...)
. Mentioned below the actual value it returns.Itseems to behave as per previous version. Maybe I'm doing something wrong ?
The friendly-number code looks like:
Which result you had ?
Logging the
schema
argument gave me thevalue
andvalue
gave meschema
andhelpers
gave meundefined
.What did you expect ?
schema
,value
,helpers
to log its own values.The text was updated successfully, but these errors were encountered: