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
import EANReader from './ean_reader';
|
|
|
|
function UPCReader() {
|
|
EANReader.call(this);
|
|
}
|
|
|
|
var properties = {
|
|
FORMAT: {value: "upc_a", writeable: false}
|
|
};
|
|
|
|
UPCReader.prototype = Object.create(EANReader.prototype, properties);
|
|
UPCReader.prototype.constructor = UPCReader;
|
|
|
|
UPCReader.prototype._decode = function() {
|
|
var result = EANReader.prototype._decode.call(this);
|
|
|
|
if (result && result.code && result.code.length === 13 && result.code.charAt(0) === "0") {
|
|
result.code = result.code.substring(1);
|
|
return result;
|
|
}
|
|
return null;
|
|
};
|
|
|
|
export default UPCReader;
|