-
Notifications
You must be signed in to change notification settings - Fork 79
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
Fixes issue #29 and allows optional fields to be omitted during object creation #30
Open
ianberryman
wants to merge
2
commits into
glenselle:master
Choose a base branch
from
ianberryman:master
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 1 commit
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,125 +1,122 @@ | ||
var utils = require('../utils'); | ||
|
||
// The date/time defaults are dynamic, so always create a new object | ||
module.exports = function () { | ||
return { | ||
recordTypeCode: { | ||
name: 'Record Type Code', | ||
width: 1, | ||
position: 1, | ||
required: true, | ||
type: 'numeric', | ||
value: '1' | ||
}, | ||
module.exports = { | ||
recordTypeCode: { | ||
name: 'Record Type Code', | ||
width: 1, | ||
position: 1, | ||
required: true, | ||
type: 'numeric', | ||
value: '1' | ||
}, | ||
|
||
priorityCode: { | ||
name: 'Priority Code', | ||
width: 2, | ||
position: 2, | ||
required: true, | ||
type: 'numeric', | ||
value: '01' | ||
}, | ||
priorityCode: { | ||
name: 'Priority Code', | ||
width: 2, | ||
position: 2, | ||
required: true, | ||
type: 'numeric', | ||
value: '01' | ||
}, | ||
|
||
immediateDestination: { | ||
name: 'Immediate Destination', | ||
width: 10, | ||
position: 3, | ||
required: true, | ||
type: 'ABA', | ||
paddingChar: ' ', | ||
value: '' | ||
}, | ||
immediateDestination: { | ||
name: 'Immediate Destination', | ||
width: 10, | ||
position: 3, | ||
required: true, | ||
type: 'ABA', | ||
paddingChar: ' ', | ||
value: '' | ||
}, | ||
|
||
immediateOrigin: { | ||
name: 'Immediate Origin', | ||
width: 10, | ||
position: 4, | ||
required: true, | ||
type: 'numeric', | ||
paddingChar: ' ', | ||
value: '' | ||
}, | ||
immediateOrigin: { | ||
name: 'Immediate Origin', | ||
width: 10, | ||
position: 4, | ||
required: true, | ||
type: 'numeric', | ||
paddingChar: ' ', | ||
value: '' | ||
}, | ||
|
||
fileCreationDate: { | ||
name: 'File Creation Date', | ||
width: 6, | ||
position: 5, | ||
required: true, | ||
type: 'numeric', | ||
value: utils.formatDate(new Date()) | ||
}, | ||
fileCreationDate: { | ||
name: 'File Creation Date', | ||
width: 6, | ||
position: 5, | ||
required: true, | ||
type: 'numeric', | ||
value: utils.formatDate(new Date()) | ||
}, | ||
|
||
fileCreationTime: { | ||
name: 'File Creation Time', | ||
width: 4, | ||
position: 6, | ||
required: true, | ||
type: 'numeric', | ||
value: utils.formatTime(new Date()) | ||
}, | ||
fileCreationTime: { | ||
name: 'File Creation Time', | ||
width: 4, | ||
position: 6, | ||
required: true, | ||
type: 'numeric', | ||
value: utils.formatTime(new Date()) | ||
}, | ||
|
||
fileIdModifier: { | ||
name: 'File Modifier', | ||
width: 1, | ||
position: 7, | ||
required: true, | ||
type: 'alphanumeric', | ||
value: 'A' | ||
}, | ||
fileIdModifier: { | ||
name: 'File Modifier', | ||
width: 1, | ||
position: 7, | ||
required: true, | ||
type: 'alphanumeric', | ||
value: 'A' | ||
}, | ||
|
||
recordSize: { | ||
name: 'Record Size', | ||
width: 3, | ||
position: 8, | ||
type: 'numeric', | ||
required: true, | ||
value: '094' | ||
}, | ||
recordSize: { | ||
name: 'Record Size', | ||
width: 3, | ||
position: 8, | ||
type: 'numeric', | ||
required: true, | ||
value: '094' | ||
}, | ||
|
||
blockingFactor: { | ||
name: 'Blocking Factor', | ||
width: 2, | ||
position: 9, | ||
type: 'numeric', | ||
required: true, | ||
value: '10' | ||
}, | ||
blockingFactor: { | ||
name: 'Blocking Factor', | ||
width: 2, | ||
position: 9, | ||
type: 'numeric', | ||
required: true, | ||
value: '10' | ||
}, | ||
|
||
formatCode: { | ||
name: 'Format Code', | ||
width: 1, | ||
position: 10, | ||
required: true, | ||
type: 'numeric', | ||
value: '1' | ||
}, | ||
formatCode: { | ||
name: 'Format Code', | ||
width: 1, | ||
position: 10, | ||
required: true, | ||
type: 'numeric', | ||
value: '1' | ||
}, | ||
|
||
immediateDestinationName: { | ||
name: 'Immediate Destination Name', | ||
width: 23, | ||
position: 11, | ||
required: true, | ||
type: 'alphanumeric', | ||
value: '' | ||
}, | ||
immediateDestinationName: { | ||
name: 'Immediate Destination Name', | ||
width: 23, | ||
position: 11, | ||
required: true, | ||
type: 'alphanumeric', | ||
value: '' | ||
}, | ||
|
||
immediateOriginName: { | ||
name: 'Immediate Origin Name', | ||
width: 23, | ||
position: 12, | ||
required: true, | ||
type: 'alphanumeric', | ||
value: '' | ||
}, | ||
immediateOriginName: { | ||
name: 'Immediate Origin Name', | ||
width: 23, | ||
position: 12, | ||
required: true, | ||
type: 'alphanumeric', | ||
value: '' | ||
}, | ||
|
||
referenceCode: { | ||
name: 'Reference Code', | ||
width: 8, | ||
position: 13, | ||
required: true, | ||
type: 'alphanumeric', | ||
value: '' | ||
} | ||
}; | ||
}; | ||
referenceCode: { | ||
name: 'Reference Code', | ||
width: 8, | ||
position: 13, | ||
required: false, | ||
type: 'alphanumeric', | ||
value: utils.SPACE.repeat(8) | ||
} | ||
}; | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,6 +4,7 @@ var _ = require('lodash'); | |
var moment = require('moment'); | ||
var nACHError = require('./error'); | ||
var counter = 0; | ||
const SPACE = " "; | ||
|
||
// Pad a given string to a fixed width using any character or number (defaults to one blank space) | ||
// Both a string and width are required params for this function, but it also takes two optional | ||
|
@@ -157,4 +158,5 @@ module.exports.getNextMultiple = getNextMultiple; | |
module.exports.overrideLowLevel = overrideLowLevel; | ||
module.exports.computeCheckDigit = computeCheckDigit; | ||
module.exports.computeBusinessDay = computeBusinessDay; | ||
module.exports.getNextMultipleDiff = getNextMultipleDiff; | ||
module.exports.getNextMultipleDiff = getNextMultipleDiff; | ||
module.exports.SPACE = SPACE; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. While we're at it, it would be nice to add the file-ending newline here too. |
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.
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 suppose removing the newline at the end of the file was not intentional. Could you put it back in?