qrcode-terminal
Advanced tools
Comparing version 0.6.0 to 0.7.0
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 | ||
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
42868
1029
0