Socket
Socket
Sign inDemoInstall

javascript-barcode-reader

Package Overview
Dependencies
211
Maintainers
1
Versions
51
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.5.4 to 0.6.0

dist/javascript-barcode-reader.es5.js

162

package.json
{
"author": "mubaidr@gmail.com",
"browser": "dist/javascript-barcode-reader.min.js",
"bugs": {
"url": "https://github.com/mubaidr/Javascript-Barcode-Reader/issues"
"author": "Muhammad Ubaid Raza <mubaidr@gmail.com>",
"commitlint": {
"extends": [
"@commitlint/config-conventional"
]
},
"config": {
"commitizen": {
"path": "node_modules/cz-conventional-changelog"
}
},
"dependencies": {
"jimp": "^0.8.4"
"jimp": "^0.9.3"
},
"description": "Simple & Fast Barcode decoder for Browser and Node.js",
"devDependencies": {
"@babel/core": "^7.6.2",
"@babel/plugin-syntax-dynamic-import": "^7.2.0",
"@babel/plugin-transform-runtime": "^7.6.2",
"@babel/preset-env": "7.6.2",
"@babel/runtime": "^7.6.2",
"babel-eslint": "^10.0.3",
"eslint": "^6.5.1",
"eslint-config-prettier": "^6.3.0",
"jest": "^24.9.0",
"rollup": "^1.22.0",
"rollup-plugin-babel": "^4.3.3",
"rollup-plugin-commonjs": "^10.1.0",
"@babel/core": "^7.8.4",
"@babel/plugin-proposal-class-properties": "^7.8.3",
"@babel/plugin-proposal-object-rest-spread": "^7.8.3",
"@babel/preset-env": "^7.8.4",
"@commitlint/cli": "^8.3.5",
"@commitlint/config-conventional": "^8.3.4",
"@rollup/plugin-commonjs": "^11.0.2",
"@types/babel__core": "^7.1.4",
"@types/eslint": "^6.1.8",
"@types/eslint-plugin-prettier": "^2.2.0",
"@types/jest": "^25.1.2",
"@types/lodash.camelcase": "^4.3.6",
"@types/node": "^13.7.1",
"@types/prettier": "^1.19.0",
"@types/rimraf": "^2.0.3",
"@types/rollup-plugin-json": "^3.0.2",
"@types/semantic-release": "^15.13.1",
"@types/shelljs": "^0.8.6",
"@typescript-eslint/eslint-plugin": "^2.20.0",
"@typescript-eslint/parser": "^2.20.0",
"canvas": "^2.6.1",
"colors": "^1.4.0",
"commitizen": "^4.0.3",
"coveralls": "^3.0.9",
"cross-env": "^7.0.0",
"cz-conventional-changelog": "^3.1.0",
"eslint": "^6.8.0",
"eslint-config-prettier": "^6.10.0",
"eslint-plugin-jest": "^23.7.0",
"eslint-plugin-prettier": "^3.1.2",
"husky": "^4.2.3",
"jest": "^25.1.0",
"jest-config": "^25.1.0",
"jest-environment-jsdom": "^25.1.0",
"lint-staged": "^10.0.7",
"lodash.camelcase": "^4.3.0",
"prettier": "^1.19.1",
"prompt": "^1.0.0",
"replace-in-file": "^5.0.2",
"rimraf": "^3.0.2",
"rollup": "^1.31.1",
"rollup-plugin-json": "^4.0.0",
"rollup-plugin-node-resolve": "^5.2.0",
"rollup-plugin-terser": "^5.1.2"
"rollup-plugin-sourcemaps": "^0.5.0",
"rollup-plugin-typescript2": "^0.26.0",
"semantic-release": "^17.0.4",
"shelljs": "^0.8.3",
"ts-jest": "^25.2.0",
"ts-node": "^8.6.2",
"typedoc": "^0.16.10",
"typescript": "^3.7.5"
},
"engines": {
"node": ">=6.0.0"
},
"files": [
"src",
"dist"
],
"homepage": "https://github.com/mubaidr/Javascript-Barcode-Reader#readme",
"jest": {
"collectCoverageFrom": [
"src/*.{js,ts}"
],
"coveragePathIgnorePatterns": [
"/node_modules/",
"/test/",
"/dist/",
"/docs/",
"/tools/"
],
"coverageThreshold": {
"global": {
"branches": 85,
"functions": 100,
"lines": 90,
"statements": 90
}
},
"moduleFileExtensions": [
"ts",
"tsx",
"js"
],
"testEnvironment": "jsdom",
"testEnvironmentOptions": {
"resources": "usable"
},
"testPathIgnorePatterns": [
"/node_modules/",
"/src/",
"/dist/",
"/docs/",
"/tools/"
],
"testRegex": "(/__tests__/.*|\\.(test|spec))\\.(ts|tsx|js)$",
"transform": {
".(ts|tsx)": "ts-jest"
}
},
"keywords": [

@@ -40,18 +125,39 @@ "barcode",

"license": "MIT",
"main": "src/index.js",
"module": "dist/javascript-barcode-reader.esm.min.js",
"lint-staged": {
"{src,test}/**/*.ts": [
"prettier --write",
"git add"
]
},
"main": "dist/javascript-barcode-reader.umd.js",
"module": "dist/javascript-barcode-reader.es5.js",
"name": "javascript-barcode-reader",
"peerDependencies": {
"gpu.js": "^2.6.9"
},
"prettier": {
"semi": false,
"singleQuote": true
},
"repository": {
"type": "git",
"url": "git+https://github.com/mubaidr/Javascript-Barcode-Reader.git"
"url": "git://github.com/mubaidr/Javascript-Barcode-Reader.git"
},
"scripts": {
"build": "rollup -c",
"dev": "",
"lint": "eslint --fix src/",
"start": "",
"test": "jest",
"build": "tsc --module commonjs && rollup -c rollup.config.ts && typedoc --out docs --target es6 --theme minimal --mode file src",
"commit": "git-cz",
"deploy-docs": "ts-node tools/gh-pages-publish",
"lint": "eslint --ext .js,.ts {src,test}/* --fix && prettier --write \"{test,src}/**/*.{js,ts}\"",
"prebuild": "rimraf dist",
"precommit": "lint-staged",
"report-coverage": "cat ./coverage/lcov.info | coveralls",
"semantic-release": "semantic-release",
"semantic-release-prepare": "ts-node tools/semantic-release-prepare",
"start": "rollup -c rollup.config.ts -w",
"test": "jest --coverage",
"test:prod": "npm run lint && npm run test -- --no-cache",
"test:watch": "jest --watch"
},
"version": "0.5.4"
"typings": "dist/types/javascript-barcode-reader.d.ts",
"version": "0.6.0"
}

120

README.md

@@ -16,29 +16,26 @@ # Javascript-Barcode-Reader

## Demo
## Try now
http://mubaidr.js.org/Javascript-Barcode-Reader/
https://stackblitz.com/edit/javascript-barcode-reader?file=index.ts
## Available decoders
<ul>
<li><input type="checkbox" disabled checked> EAN-13</li>
<li><input type="checkbox" disabled checked> EAN-8</li>
<li><input type="checkbox" disabled checked> Code-39</li>
<li><input type="checkbox" disabled checked> Code-93</li>
<li><input type="checkbox" disabled checked> Code-2of5
<ul>
<li><input type="checkbox" disabled checked> standard</li>
<li><input type="checkbox" disabled checked> Interleaved</li>
</ul>
</li>
<li><input type="checkbox" disabled checked> Codabar</li>
<li><input type="checkbox" disabled checked> Code-128 (UCC/EAN-128)</li>
</ul>
- EAN-13
- EAN-8
- Code-39
- Code-93
- Code-2of5
- standard
- Interleaved
- Codabar
- Code-128 (UCC/EAN-128)
## Install
## How to use
### Install
Recommended way to install is by using package manager (npm, yarn etc):
```bash
npm install --save javascript-barcode-reader
npm i javascript-barcode-reader
```

@@ -54,6 +51,4 @@

[javascript-barcode-reader.js](https://unpkg.com/javascript-barcode-reader)
[javascript-barcode-reader](https://unpkg.com/javascript-barcode-reader)
## How to use
### Node.js

@@ -63,14 +58,13 @@

const javascriptBarcodeReader = require('javascript-barcode-reader')
```
#### Using promise
```js
javascriptBarcodeReader(
Image /* Image file Path || {data: pixelArray, width, height} || HTML5 Canvas ImageData */,
{
barcode: 'code-2of5',
type: 'industrial', //optional type
javascriptBarcodeReader({
/* Image file Path || {data: Uint8ClampedArray, width, height} || HTML5 Canvas ImageData */
image: source,
barcode: 'code-2of5',
// barcodeType: 'industrial',
options: {
// useAdaptiveThreshold: true
// singlePass: true
}
)
})
.then(code => {

@@ -84,18 +78,2 @@ console.log(code)

#### Using await
```js
try {
const code = await javascriptBarcodeReader(
Image /* Image file Path || {data: pixelArray, width, height} || HTML5 Canvas ImageData */,
{
barcode: 'code-2of5',
type: 'industrial', //optional type
}
)
} catch (err) {
console.log(err)
}
```
### Browser

@@ -105,12 +83,13 @@

### Using promise
```js
javascriptBarcodeReader(
Image /* Image ID || HTML5 Image || HTML5 Canvas || HTML5 Canvas ImageData || Image URL */,
{
barcode: 'code-2of5',
type: 'industrial', //optional type
javascriptBarcodeReader({
/* Image ID || HTML5 Image || HTML5 Canvas || HTML5 Canvas ImageData || Image URL */
image: source,
barcode: 'code-2of5',
// barcodeType: 'industrial',
options: {
// useAdaptiveThreshold: true
// singlePass: true
}
)
})
.then(code => {

@@ -124,36 +103,13 @@ console.log(code)

#### Using await
## Note
```js
try {
const code = await javascriptBarcodeReader(
Image /* Image ID || HTML5 Image || HTML5 Canvas || HTML5 Canvas ImageData || Image URL */,
{
barcode: 'code-2of5',
type: 'industrial', //optional type
}
)
} catch (err) {
console.log(err)
}
```
## Tips
- This script does not implement logic to locate/rotate barcode in the given image.
- Make sure the barcode image is the only thing in the image. Otherwise this script will most probably fail.
## Known Issues
This script does not implement logic to locate/rotate barcode in the given image.
## Contributing
All the modules are contianed in `src` directory. If you implement a new module or update an existing one, then make sure to add/run tests by running:
All decoders are defined in `src` directory.
```bash
npm test
```
Tests are defined in the `tests` directory using `Jest`.
Tests are defined in the `__tests__` directory using `Jest`.
There is no need to run build script before creating pull request.

@@ -160,0 +116,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