Socket
Socket
Sign inDemoInstall

javascript-barcode-reader

Package Overview
Dependencies
0
Maintainers
1
Versions
51
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.1.3 to 0.1.4

12

dist/javascript-barcode-reader.js

@@ -1,10 +0,10 @@

parcelRequire=function(e,r,n,t){var i="function"==typeof parcelRequire&&parcelRequire,o="function"==typeof require&&require;function u(n,t){if(!r[n]){if(!e[n]){var f="function"==typeof parcelRequire&&parcelRequire;if(!t&&f)return f(n,!0);if(i)return i(n,!0);if(o&&"string"==typeof n)return o(n);var c=new Error("Cannot find module '"+n+"'");throw c.code="MODULE_NOT_FOUND",c}p.resolve=function(r){return e[n][1][r]||r};var l=r[n]=new u.Module(n);e[n][0].call(l.exports,p,l,l.exports,this)}return r[n].exports;function p(e){return u(p.resolve(e))}}u.isParcelRequire=!0,u.Module=function(e){this.id=e,this.bundle=u,this.exports={}},u.modules=e,u.cache=r,u.parent=i,u.register=function(r,n){e[r]=[function(e,r){r.exports=n},{}]};for(var f=0;f<n.length;f++)u(n[f]);if(n.length){var c=u(n[n.length-1]);"object"==typeof exports&&"undefined"!=typeof module?module.exports=c:"function"==typeof define&&define.amd?define(function(){return c}):t&&(this[t]=c)}return u}({3:[function(require,module,exports) {
parcelRequire=function(e,r,n,t){var i="function"==typeof parcelRequire&&parcelRequire,o="function"==typeof require&&require;function u(n,t){if(!r[n]){if(!e[n]){var f="function"==typeof parcelRequire&&parcelRequire;if(!t&&f)return f(n,!0);if(i)return i(n,!0);if(o&&"string"==typeof n)return o(n);var c=new Error("Cannot find module '"+n+"'");throw c.code="MODULE_NOT_FOUND",c}p.resolve=function(r){return e[n][1][r]||r};var l=r[n]=new u.Module(n);e[n][0].call(l.exports,p,l,l.exports,this)}return r[n].exports;function p(e){return u(p.resolve(e))}}u.isParcelRequire=!0,u.Module=function(e){this.id=e,this.bundle=u,this.exports={}},u.modules=e,u.cache=r,u.parent=i,u.register=function(r,n){e[r]=[function(e,r){r.exports=n},{}]};for(var f=0;f<n.length;f++)u(n[f]);if(n.length){var c=u(n[n.length-1]);"object"==typeof exports&&"undefined"!=typeof module?module.exports=c:"function"==typeof define&&define.amd?define(function(){return c}):t&&(this[t]=c)}return u}({21:[function(require,module,exports) {
var n={10001:"1","01001":"2",11000:"3","00101":"4",10100:"5","01100":"6","00011":"7",10010:"8","01010":"9","00110":"10"},r={"01000":"0","00100":"10","00010":"20",10000:"30"},t=["1","2","3","4","5","6","7","8","9","0","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","-",".","␣","*"],e=function(e){e.push(3);for(var u="",o=function(o){var i=e.slice(o,o+10),c=Math.round(i.reduce(function(n,r){return n+r},0)/i.length),f=i.map(function(n){return n>c?1:0}),a=f.filter(function(n,r){return r%2==0}).join(""),l=f.filter(function(n,r){return r%2!=0}).join("");u+=t[parseInt(n[a],10)-1+parseInt(r[l],10)]},i=1;i<e.length;i+=10)o(i);return u.substring(1,u.length-1)};module.exports={decode:e};
},{}],4:[function(require,module,exports) {
},{}],22:[function(require,module,exports) {
var n={10001:"1","01001":"2",11000:"3","00101":"4",10100:"5","01100":"6","00011":"7",10010:"8","01010":"9","00110":"10"},r={"01000":"0","00100":"10","00010":"20",10000:"30"},t=["1","2","3","4","5","6","7","8","9","0","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","-",".","␣","*"],e=function(e){e.push(0);for(var u="",o=function(o){var i=e.slice(o,o+10),c=Math.round(i.reduce(function(n,r){return n+r},0)/i.length),f=i.map(function(n){return n>c?1:0}),a=f.filter(function(n,r){return r%2==0}).join(""),l=f.filter(function(n,r){return r%2!=0}).join("");u+=t[parseInt(n[a],10)-1+parseInt(r[l],10)]},i=1;i<e.length;i+=10)o(i);return u.substring(1,u.length-1)};module.exports={decode:e};
},{}],5:[function(require,module,exports) {
},{}],23:[function(require,module,exports) {
var r={3211:"0",2221:"1",2122:"2",1411:"3",1132:"4",1231:"5",1114:"6",1312:"7",1213:"8",3112:"9"},e=function(e){for(var n="",o=~~((e[1]+e[2]+e[3])/3),t=1;t<e.length;t+=1){var d=void 0;d=n.length<6?e.slice(4*t,4*t+4):e.slice(4*t+5,4*t+9);var a=[Math.round(d[0]/o),Math.round(d[1]/o),Math.round(d[2]/o),Math.round(d[3]/o)];if(12===(n+=r[a.join("")]||r[a.reverse().join("")]||"X").length)return n}return-1===n.indexOf("X")&&n||!1};module.exports={decode:e};
},{}],1:[function(require,module,exports) {
var e=require("./code-93"),r=require("./code-39"),a=require("./ean-13"),t={"code-93":e,"code-39":r,"ean-13":a},o=function(e,r){var a=void 0;"string"==typeof e&&(e=document.getElementById(e));var o=e.tagName;if("IMG"===o){var d=document.createElement("canvas");d.width=e.naturalWidth,d.height=e.naturalHeight;var i=d.getContext("2d");i.drawImage(e,0,0),a=i.getImageData(0,0,e.naturalWidth,e.naturalHeight)}else if("CANVAS"===o)a=e.getContext("2d").getImageData(0,0,e.naturalWidth,e.naturalHeight);else{if(!e.data)throw new Error("Invalid image source specified!");a=e}for(var n=a,u=n.data,f=n.width,c=n.height,h=[1,9,2,8,3,7,4,6,5],l=h.length,v=c/(l+1);l-=1;){for(var g=4*f*Math.floor(v*h[l]),s=4*f*Math.floor(v*h[l])+8*f,m=u.slice(g,s),p=[],x=0,I=0,w=0;w<2;w+=1)for(var y=0;y<f;y+=1){var D=4*(w*f+y),b=(3*m[D]+4*m[D+1]+2*m[D+2])/9,q=p[y];m[D]=b,m[D+1]=b,m[D+2]=b,p[y]=b+(void 0===q?0:q)}for(var C=0;C<f;C+=1){p[C]/=2;var E=p[C];E<x&&(x=E),E>I&&(I=E)}for(var H=x+(I-x)/2,M=[],W=0;W<f;W+=1){for(var A=0,N=0;N<2;N+=1)m[4*(N*f+W)]>H&&(A+=1);M.push(A>1)}for(var B=M[0],G=1,S=[],V=0;V<f;V+=1)M[V]===B?G+=1:(S.push(G),G=1,B=M[V]);return t[r.barcode].decode(S)}return!1};"undefined"!=typeof exports?("undefined"!=typeof module&&module.exports&&(exports=o,module.exports=o),exports.barcodeDecoder=o):root.barcodeDecoder=o;
},{"./code-93":3,"./code-39":4,"./ean-13":5}]},{},[1], null)
},{}],26:[function(require,module,exports) {
var e=require("./code-93"),r=require("./code-39"),a=require("./ean-13"),t={"code-93":e,"code-39":r,"ean-13":a},o=function(e,r){var a=void 0;"string"==typeof e&&(e=document.getElementById(e));var o=e.tagName;if("IMG"===o){var d=document.createElement("canvas");d.width=e.naturalWidth,d.height=e.naturalHeight;var n=d.getContext("2d");n.drawImage(e,0,0),a=n.getImageData(0,0,e.naturalWidth,e.naturalHeight)}else if("CANVAS"===o)a=e.getContext("2d").getImageData(0,0,e.naturalWidth,e.naturalHeight);else{if(!e.data)throw new Error("Invalid image source specified!");a=e}var i=a,u=i.data,l=i.width,f=i.height;e=null,a=null;for(var v=[1,9,2,8,3,7,4,6,5],c=v.length,h=f/(c+1);c-=1;){for(var g=4*l*Math.floor(h*v[c]),s=4*l*Math.floor(h*v[c])+8*l,m=u.slice(g,s),p=[],x=0,I=0,w=0;w<2;w+=1)for(var y=0;y<l;y+=1){var D=4*(w*l+y),b=(3*m[D]+4*m[D+1]+2*m[D+2])/9,q=p[y];m[D]=b,m[D+1]=b,m[D+2]=b,p[y]=b+(void 0===q?0:q)}for(var C=0;C<l;C+=1){p[C]/=2;var E=p[C];E<x&&(x=E),E>I&&(I=E)}for(var H=x+(I-x)/2,M=[],W=0;W<l;W+=1){for(var A=0,N=0;N<2;N+=1)m[4*(N*l+W)]>H&&(A+=1);M.push(A>1)}for(var B=M[0],G=1,S=[],V=0;V<l;V+=1)M[V]===B?G+=1:(S.push(G),G=1,B=M[V]);return t[r.barcode].decode(S)}return null};"undefined"!=typeof exports?("undefined"!=typeof module&&module.exports&&(exports=o,module.exports=o),exports.barcodeDecoder=o):root.barcodeDecoder=o;
},{"./code-93":21,"./code-39":22,"./ean-13":23}]},{},[26], null)
//# sourceMappingURL=/javascript-barcode-reader.map

@@ -6,3 +6,3 @@ {

},
"description": "A Barcode scanner in javascript",
"description": "Barcode reader solution in Javascript for Browser and Node.js",
"devDependencies": {

@@ -20,4 +20,9 @@ "babel-cli": "^6.26.0",

"eslint-plugin-standard": "^3.1.0",
"parcel-bundler": "^1.8.1"
"parcel-bundler": "^1.8.1",
"rimraf": "^2.6.2"
},
"files": [
"src",
"dist"
],
"homepage": "https://github.com/mubaidr/Javascript-Barcode-Reader#readme",

@@ -32,6 +37,2 @@ "keywords": [

"license": "MIT",
"files": [
"src",
"dist"
],
"main": "src/index.js",

@@ -45,7 +46,7 @@ "name": "javascript-barcode-reader",

"build": "parcel build src/index.js --out-dir dist --out-file javascript-barcode-reader",
"build-docs": "parcel build docs-src/index.html --out-dir docs",
"dev": "parcel docs-src/index.html --out-dir build --no-cache",
"build-docs": "rimraf docs/ && parcel build docs-src/index.html --out-dir docs",
"dev": "rimraf build/ && parcel docs-src/index.html --out-dir build --no-cache",
"lint": "eslint --fix src/"
},
"version": "0.1.3"
"version": "0.1.4"
}

@@ -5,2 +5,10 @@ # Javascript-Barcode-Reader

<a href="https://patreon.com/mubaidr">
<img src="https://c5.patreon.com/external/logo/become_a_patron_button@2x.png" height="42">
</a>
[![NPM](https://nodei.co/npm/javascript-barcode-reader.png?compact=true)](https://nodei.co/npm/javascript-barcode-reader/)
![dependencies](https://david-dm.org/mubaidr/javascript-barcode-reader.svg)
## Available decoders

@@ -7,0 +15,0 @@

@@ -48,2 +48,4 @@ const DecoderCode93 = require('./code-93')

const { data, width, height } = ImageData
imageSource = null
ImageData = null

@@ -127,3 +129,3 @@ // check points for barcode location

}
return false
return null
}

@@ -130,0 +132,0 @@

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc