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.
31 lines
771 B
JavaScript
31 lines
771 B
JavaScript
/* jshint undef: true, unused: true, browser:true, devel: true */
|
|
/* global define */
|
|
|
|
define(
|
|
[
|
|
"./ean_reader"
|
|
],
|
|
function(EANReader) {
|
|
"use strict";
|
|
|
|
function UPCReader() {
|
|
EANReader.call(this);
|
|
}
|
|
|
|
UPCReader.prototype = Object.create(EANReader.prototype);
|
|
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;
|
|
};
|
|
|
|
return (UPCReader);
|
|
}
|
|
); |