-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Implement https://github.com/mholt/PapaParse/issues/612 #898
base: master
Are you sure you want to change the base?
Conversation
This is related to #612 |
Please do not update the minified file, this will be done by our release process. |
@@ -510,8 +510,20 @@ <h5 id="config-details">Config Options</h5> | |||
<code>transformHeader</code> | |||
</td> | |||
<td> | |||
A function to apply on each header. Requires <code>header</code> to be <code>true</code>. The function receives the header as its first argument and the index as second.<br> | |||
Only available starting with version 5.0. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we should keep that this is only availalbe on the version 5.0
I also plan to do a minor version for the parameter. So the new parameter structure should be only available on 5.4+ versions. That should be noted too.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Resolved with ac6f191
} | ||
// if _results.data[0] is not an array, we are in a step where _results.data is the row. | ||
else | ||
_results.data.forEach(addHeader); | ||
_results.data.forEach(addHeader.bind(null, 0)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is bind required? Could we just ignore make the arguments at the end and optional?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Bind is required because we're trying to parse a function into the .forEach() method, and unfortunately we have
"no-loop-func": "error"
and ecma5 versioning in our eslint config, which I think means no arrow functions. I assume this is for reasons of universalisable compatibility and speed. As a result, this is the only way to pass the loop iterator into the function.
Resolved with 417982c |
@pokoli and else, is there any update on this? |
We need a bug fix release before merging this. |
-- The whole headers row as an array (arr)
-- The previous value of the header in that column (acc)
-- The row number (j)