Fix two bugs when providing options to new File() and new Batch() #31
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Hey there, we're using this for a banking partner that has an alphanumeric (instead of numeric) immediateOrigin value and company ID value. I went to override these values in the schema by using the
options.header
andoptions.control
values in File and Batch but discovered a couple of bugs there.Essentially my code looked like this:
First, that since the code was using
_.merge
, the default settings overwrote the ones I passed in, so the type of immediate origin ended up staying as "numeric".Second,
_.merge
mutates its input, so my FILE_OPTS constants were changed to the nACH2 defaults.Third, the code in batch/index.js was using the "header" setting for the control options.
I fixed that in our fork by using
_.defaultsDeep
instead of_.merge
, providing a new empty object to avoid mutating whatever the user has passed in to the constructor, and corrected the typo in the batch options setting to use options.control.