New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

browser-barcodescanner

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

browser-barcodescanner - npm Package Compare versions

Comparing version 1.0.4 to 1.0.5

README.md

9

dist/index.cjs.js

@@ -9,3 +9,5 @@ 'use strict';

callback({
res: barcodes[0].rawValue
res: barcodes[0].rawValue,
corner: barcodes[0].cornerPoints,
box: barcodes[0].boundingBox
});

@@ -18,2 +20,6 @@ });

// Check if the parameter sare valid
if (!Array.isArray(formats) || formats.length === 0) throw new Error('Invalid formats, please provide at least one type of format. See https://developer.mozilla.org/en-US/docs/Web/API/Barcode_Detection_API#supported_barcode_formats for a list of supported formats.');
if (object === null) throw new Error('Invalid object, please provide a File, HTMLVideoElement, HTMLImageElement or HTMLCanvasElement.');
// Check if the format is supported

@@ -23,3 +29,2 @@ const supportedFormats = await window.BarcodeDetector.getSupportedFormats();

if (unsupportedFormats.length > 0) throw new Error(`The following formats are not supported: ${unsupportedFormats.join(', ')}`);
if (!object) throw new Error('Element or File to scan not provided');
if (object instanceof File) {

@@ -26,0 +31,0 @@ /* If the object is a file, we need to convert it to a data URL */

@@ -7,3 +7,5 @@ function BarcodeScanner(callback, formats, object) {

callback({
res: barcodes[0].rawValue
res: barcodes[0].rawValue,
corner: barcodes[0].cornerPoints,
box: barcodes[0].boundingBox
});

@@ -16,2 +18,6 @@ });

// Check if the parameter sare valid
if (!Array.isArray(formats) || formats.length === 0) throw new Error('Invalid formats, please provide at least one type of format. See https://developer.mozilla.org/en-US/docs/Web/API/Barcode_Detection_API#supported_barcode_formats for a list of supported formats.');
if (object === null) throw new Error('Invalid object, please provide a File, HTMLVideoElement, HTMLImageElement or HTMLCanvasElement.');
// Check if the format is supported

@@ -21,3 +27,2 @@ const supportedFormats = await window.BarcodeDetector.getSupportedFormats();

if (unsupportedFormats.length > 0) throw new Error(`The following formats are not supported: ${unsupportedFormats.join(', ')}`);
if (!object) throw new Error('Element or File to scan not provided');
if (object instanceof File) {

@@ -24,0 +29,0 @@ /* If the object is a file, we need to convert it to a data URL */

{
"name": "browser-barcodescanner",
"version": "1.0.4",
"version": "1.0.5",
"description": "A browser API based barcode scanner",

@@ -5,0 +5,0 @@ "main": "dist/index.cjs.js",

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc