UNPKG

react-fancy-qrcode

Version:

Customizable QR code generated for React & React Native

16 lines 555 B
import QRCodeGenerator from "qrcode"; export var generateDataMatrix = function (value, errorCorrection) { var data = QRCodeGenerator.create(value, { errorCorrectionLevel: errorCorrection, }).modules.data; var sideCount = Math.sqrt(data.length); // Convert array of pixels to rows/columns return data.reduce(function (rows, pixel, index) { if (index % sideCount === 0) { rows.push([]); } rows[rows.length - 1].push(pixel); return rows; }, []); }; //# sourceMappingURL=utils.js.map