forked from serratus/quaggaJS
-
Notifications
You must be signed in to change notification settings - Fork 0
/
ean_8_reader.js
45 lines (36 loc) · 1.16 KB
/
ean_8_reader.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
/* jshint undef: true, unused: true, browser:true, devel: true */
/* global define */
define(
[
"./ean_reader"
],
function(EANReader) {
"use strict";
function EAN8Reader() {
EANReader.call(this);
}
EAN8Reader.prototype = Object.create(EANReader.prototype);
EAN8Reader.prototype.constructor = EAN8Reader;
EAN8Reader.prototype._decodePayload = function(code, result, decodedCodes) {
var i,
self = this;
for ( i = 0; i < 4; i++) {
code = self._decodeCode(code.end, self.CODE_G_START);
result.push(code.code);
decodedCodes.push(code);
}
code = self._findPattern(self.MIDDLE_PATTERN, code.end, true);
if (code === null) {
return null;
}
decodedCodes.push(code);
for ( i = 0; i < 4; i++) {
code = self._decodeCode(code.end, self.CODE_G_START);
decodedCodes.push(code);
result.push(code.code);
}
return code;
};
return (EAN8Reader);
}
);