-
Notifications
You must be signed in to change notification settings - Fork 979
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
Allow multiple barcodes to be decoded #90
Merged
Merged
Changes from 5 commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
e4cba7f
chore: fix dev dependencies
dgreif 09e1cd4
chore: add lint script
dgreif afeb37b
feat: allow multiple barcodes to be decoded
dgreif a1ded4b
docs: add `multiple` to docs
dgreif 9ebb69e
docs: wrap at 80 characters
dgreif 74c4f04
refactor: move result check to higher level
dgreif 9a9b8de
fix: publish `detected` event for `multiple`
dgreif 2c14a48
feat: return `multiple` as array instead of object
dgreif 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,7 +11,9 @@ | |
"babel-loader": "^5.3.2", | ||
"chai": "^3.4.1", | ||
"core-js": "^1.2.1", | ||
"eslint": "^1.10.3", | ||
"grunt": "^0.4.5", | ||
"grunt-cli": "^0.1.13", | ||
"grunt-contrib-nodeunit": "^0.4.1", | ||
"grunt-karma": "^0.12.1", | ||
"isparta-loader": "^1.0.0", | ||
|
@@ -21,9 +23,8 @@ | |
"karma-coverage": "^0.5.2", | ||
"karma-mocha": "~0.2.0", | ||
"karma-phantomjs-launcher": "^0.2.1", | ||
"karma-sinon-chai": "^1.1.0", | ||
"karma-sinon": "^1.0.4", | ||
"karma-sinon-chai": "~0.2.0", | ||
"karma-sinon-chai": "^1.1.0", | ||
"karma-source-map-support": "^1.1.0", | ||
"karma-webpack": "^1.7.0", | ||
"mocha": "^2.3.2", | ||
|
@@ -39,7 +40,8 @@ | |
"test": "grunt test", | ||
"integrationtest": "grunt integrationtest", | ||
"build": "webpack && webpack --config webpack.config.min.js && grunt uglyasm && webpack --config webpack.node.config.js", | ||
"watch": "webpack --watch" | ||
"watch": "webpack --watch", | ||
"lint": "eslint src" | ||
}, | ||
"repository": { | ||
"type": "git", | ||
|
@@ -63,7 +65,7 @@ | |
], | ||
"author": "Christoph Oberhofer <[email protected]>", | ||
"license": "MIT", | ||
"engines":{ | ||
"engines": { | ||
"node": ">= 4.0" | ||
}, | ||
"dependencies": { | ||
|
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
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.
The
detected
event is not fired any more whenmultiple
is activated. Maybe you could expand the condition to include something like:result.barcodes && result.barcodes.length > 0
. And since you only add the results to this array if the decoding was successful, this should be sufficient.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 must have overlooked the last part of that method the first time through, good catch. I just pushed a fix for it which also future-proofs the check if we decide to return an array instead of an object. I'm making the assumption that some of the barcodes might not have a
codeResult
instead of just checkingbarcodes.length
. If you agree that's the way we should go I will commit the array result change.