Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

qrcode-terminal

Package Overview
Dependencies
Maintainers
2
Versions
18
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

qrcode-terminal - npm Package Compare versions

Comparing version 0.6.0 to 0.7.0

41

lib/main.js
var QRCode = require('./../vendor/QRCode'),
QRErrorCorrectLevel = require('./../vendor/QRCode/QRErrorCorrectLevel'),
colors = require('colors');
colors = require('colors'),
black = " ",
white = " ".white.inverse,
toCell = function (isBlack) {
return isBlack ? black : white;
},
repeat = function (color) {
return {
times: function (count) {
return new Array(count).join(color);
}
};
};
module.exports = {
generate: function (text, cb) {
generate: function (input, cb) {
var qrcode = new QRCode(-1, QRErrorCorrectLevel.H);
qrcode.addData(text);
qrcode.addData(input);
qrcode.make();
var border = new Array(qrcode.getModuleCount() + 3).join(' ').white.inverse + "\n",
output = "";
var output = "",
border = repeat(white).times(qrcode.getModuleCount() + 3) + "\n";
output += border;
for (var row = 0; row < qrcode.getModuleCount(); row++) {
output += " ".white.inverse;
for (var col = 0; col < qrcode.getModuleCount(); col++) {
if (qrcode.isDark(row, col)) {
output += " ";
}
else {
output += " ".white.inverse;
}
}
output += " ".white.inverse + "\n";
}
qrcode.modules.forEach(function (row) {
output += white;
output += row.map(toCell).join('');
output += white + "\n";
});
output += border;

@@ -30,0 +33,0 @@

{
"name": "qrcode-terminal",
"keywords": ["ansi", "ascii", "qrcode", "console"],
"version" : "0.6.0",
"version" : "0.7.0",
"description" : "QRCodes, in the terminal",

@@ -6,0 +6,0 @@ "homepage": "https://github.com/gtanner/qrcode-terminal",

@@ -35,4 +35,4 @@ # QRCode Terminal Edition [![Build Status][travis-ci-img]][travis-ci-url]

[travis-ci-img]: https://travis-ci.org/gtanner/qrcode-terminal.png?branch=master
[travis-ci-img]: https://travis-ci.org/gtanner/qrcode-terminal.png
[travis-ci-url]: https://travis-ci.org/gtanner/qrcode-terminal
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