You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
25 lines
597 B
JavaScript
25 lines
597 B
JavaScript
![]()
10 years ago
|
import EANReader from './ean_reader';
|
||
![]()
10 years ago
|
|
||
![]()
10 years ago
|
function UPCReader() {
|
||
|
EANReader.call(this);
|
||
|
}
|
||
![]()
10 years ago
|
|
||
![]()
10 years ago
|
var properties = {
|
||
|
FORMAT: {value: "upc_a", writeable: false}
|
||
|
};
|
||
![]()
10 years ago
|
|
||
![]()
10 years ago
|
UPCReader.prototype = Object.create(EANReader.prototype, properties);
|
||
|
UPCReader.prototype.constructor = UPCReader;
|
||
![]()
10 years ago
|
|
||
![]()
10 years ago
|
UPCReader.prototype._decode = function() {
|
||
|
var result = EANReader.prototype._decode.call(this);
|
||
![]()
10 years ago
|
|
||
![]()
10 years ago
|
if (result && result.code && result.code.length === 13 && result.code.charAt(0) === "0") {
|
||
|
result.code = result.code.substring(1);
|
||
|
return result;
|
||
![]()
10 years ago
|
}
|
||
![]()
10 years ago
|
return null;
|
||
|
};
|
||
|
|
||
![]()
10 years ago
|
export default UPCReader;
|