{"_id":"@atmulyana/qr-code","name":"@atmulyana/qr-code","dist-tags":{"latest":"0.0.1"},"versions":{"0.0.1":{"name":"@atmulyana/qr-code","version":"0.0.1","license":"MIT","repository":{"type":"git","url":"git+https://github.com/atmulyana/qr-code.git"},"description":"This package is to generate QRCode. It's a rewritten code of 'https://github.com/defunctzombie/qr.js' with some enhancements.","keywords":["qrcode","QRCode","QR","qr","code"],"main":"index.js","react-native":"lib/index.js","scripts":{"build":"flow-remove-types -p lib/ -d dist/","flow":"flow","prepublish":"npm run build"},"engines":{"node":">=12.0.0"},"dependencies":{"utf16-to-sjis":"^1.1.1"},"devDependencies":{"flow-bin":"*","flow-remove-types":"^2.215.1"},"types":"./index.d.ts","bugs":{"url":"https://github.com/atmulyana/qr-code/issues"},"homepage":"https://github.com/atmulyana/qr-code#readme","_id":"@atmulyana/qr-code@0.0.1","_nodeVersion":"16.16.0","_npmVersion":"8.11.0","dist":{"integrity":"sha512-IVxNKJB2630bDnyTggsJIghnB850oT2LcErRkMkPJr6N3DXvkR0cxfxlvdxL26zPFjfds93U/WvY7NMmrYafnA==","shasum":"c7c1384716e7764511996b98f4baa30fb5d1ea1b","tarball":"https://registry.npmjs.org/@atmulyana/qr-code/-/qr-code-0.0.1.tgz","fileCount":36,"unpackedSize":103100,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDM0NyXzFW7M5WJ7Zr5ty+0D3qLVdrVrvhPM0I8g4L2qQIgN+AElQfXI+3tZp15iceojbqEtRA6vVpY4R6SqW+Amv4="}]},"_npmUser":{"name":"atmulyana","email":"atmulyana@yahoo.com"},"directories":{},"maintainers":[{"name":"atmulyana","email":"atmulyana@yahoo.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/qr-code_0.0.1_1693410588526_0.6614869439247788"},"_hasShrinkwrap":false}},"time":{"created":"2023-08-30T15:49:48.455Z","0.0.1":"2023-08-30T15:49:48.799Z","modified":"2023-08-30T15:49:49.069Z"},"maintainers":[{"name":"atmulyana","email":"atmulyana@yahoo.com"}],"description":"This package is to generate QRCode. It's a rewritten code of 'https://github.com/defunctzombie/qr.js' with some enhancements.","homepage":"https://github.com/atmulyana/qr-code#readme","keywords":["qrcode","QRCode","QR","qr","code"],"repository":{"type":"git","url":"git+https://github.com/atmulyana/qr-code.git"},"bugs":{"url":"https://github.com/atmulyana/qr-code/issues"},"license":"MIT","readme":"# **qrcode**\n\nThis package is a rewritten package of [`qr.js`](https://github.com/defunctzombie/qr.js) with some enhancements.\nWhat we did in this package if compared to the original package:\n- There are some code optimatizations to increase performance.\n- It uses more recent Javascript features. We prefer to use an `Uint8Array` instead of an array of\n  byte numbers to store the QR code data (less memory).\n- `string` data is automatically converted to UTF-8 from UTF-16 (Javascript string encoding).\n- Beside data buffer for binary data mode, it also provides for numeric, alpha-numeric and kanji mode.\n\n## **Usage**\n```javascript\nconst qr = require('qr-code');\n\nfunction drawSquare(x, y, size, color) {\n    //The implementation depends on what you use\n    //You may use web canvas, SVG etc.\n    //...\n}\n\nconst size = 128;\nconst cells = qr('https://en.wikipedia.org/wiki/QR_code').modules;\nconst cellSize = size / cells.length;\nconst bgColor = 'white';\nconst fgColor = 'black';\n\ndrawSquare(0, 0, size, bgColor); //draws the background\nfor (let y = 0; y < cells.length; y++) {\n    for (let x = 0; x < cells.length; x++) {\n        if (cells[y][x]) {\n            drawSquare(\n                x * cellSize,\n                y * cellSize,\n                cellSize,\n                fgColor\n            );\n        }\n    }\n}\n```\n\n### **The parameters of `qr` function**\n- The first parameter is the encoded data as shown in the usage example. Not only string that you can pass as the\n  data to be encoded. The possible data types that  you can use as the first parameter:\n  + `string`  \n    The string will be converted from UTF-16 (Javascript string encoding) to UTF-8.\n  + `Uint8Array` or array of byte numbers\n  + Object `{mode, data}`  \n    QR code has several data mode. It determines how the data is encoded. If you want to specify the data mode, you\n    can use object data type whose two properties: `mode` and `data`. There are 4 possible values for `mode`:\n    1 (numeric), 2 (alpha-numeric), 4 (byte/binary) and 8 (kanji). You can use the predefined constants:\n    `qr.Mode.Numeric`, `qr.Mode.AlphaNumeric`, `qr.Mode.Byte` and `qr.Mode.Kanji`.   \n    `data` property is the data to be encoded. It's a string or will be converted to a string for non string. For\n    byte mode, there are the other acceptable data type beside string (read the detailed explanation for each mode).\n    Each mode except binary mode has restriction for what data that can be encoded. An error happens if the\n    restriction is violated. The data that can be encoded for each mode:\n    * Numeric  \n      Only numeric characters (0-9) that can be encoded.\n    * Alpha-numeric   \n      The allowed characters for this mode are `0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ $%*+-./:`\n    * Byte/Binary   \n      This mode can encode all characters in the string. The string encoding will be converted from UTF-16 to UTF-8.\n      Beside string, this mode can also accept `Uint8Array` or an array of byte numbers to be encoded. These arrays\n      will be stored as is. If the first parameter of `qr` function is a string, `Uint8Array` or array of numbers then\n      the used mode is binary.\n    * Kanji   \n      This mode to encode the words written in kanji (Japanese letters). The data string encoding will be converted\n      from UTF-16 to Shift-JIS. An error happens if there is a non-kanji character in the string.\n  + A data buffer object which is an instance of a class that extends `qr.Data` class.   \n    This package has provided data buffer class for each data mode. However, if you don't satisfy or there is a bug,\n    you can create your own data buffer class which must extends `qr.Data` class. It's also useful if there is a\n    new data mode. You can read the source code of this package (under data directory) for the example of how to\n    create a data buffer class.\n\n- The second parameter is an object for QR code setting. This parameter is optional. The object has two properties:\n  + `version`  \n    The value of `vesion` is a number between 1 to 40. This setting is to determine the size of QR code. If not defined,\n    the size will be chosen the smallest size that can accommodate the data size. If you set a `version` value whose\n    too small capacity to store the encoded data, an error will happen\n  + `errorCorrectionLevel`   \n    As its name, this setting is to set the level of how many data that can be restored if QR code is damage or cannot be\n    scanned correctly. There are 4 levels and you can use the predefined constants:\n    * `qr.ErrorCorrectionLevel.L` is low level\n    * `qr.ErrorCorrectionLevel.M` is medium level\n    * `qr.ErrorCorrectionLevel.Q` is quartile level\n    * `qr.ErrorCorrectionLevel.H` is high level\n    \n    If not defined, the default value is high level.\n\n## **Credit**\n- [`qr.js`](https://github.com/defunctzombie/qr.js) package (the rewritten package)\n- [QR Code reference](https://en.wikipedia.org/wiki/QR_code) at wikipedia\n- [QR Code data encoding](https://www.thonky.com/qr-code-tutorial/data-encoding#step-3-encode-using-the-selected-mode)\n- [UTF-16 to UTF-8 converter](https://medium.com/@vincentcorbee/utf-16-to-utf-8-in-javascript-18b4b11b6e1e)\n- [utf16-to-sjis](https://github.com/okaxaki/utf16-to-sjis) package (UTF-16 to Shift-JIS converter)","readmeFilename":"README.md"}