qrcode-terminal
Advanced tools
Comparing version 0.3.0 to 0.4.0
var foo = require('../lib/main'); | ||
foo.render('this is the bomb'); | ||
foo.generate('this is the bomb'); |
@@ -6,5 +6,3 @@ var QRCode = require('./../vendor/qrcode'), | ||
module.exports = { | ||
render: function (text) { | ||
//HACK: the two is QRErrorCorrectLevel.H | ||
generate: function (text, cb) { | ||
var qrcode = new QRCode(-1, QRErrorCorrectLevel.H); | ||
@@ -14,22 +12,25 @@ qrcode.addData(text); | ||
var border = new Array(qrcode.getModuleCount() + 3).join(' ').white.inverse + "\n", | ||
output = ""; | ||
var border = new Array(qrcode.getModuleCount() + 3).join(' ').white.inverse; | ||
console.log(border); | ||
output += border; | ||
for (var row = 0; row < qrcode.getModuleCount(); row++) { | ||
var str = " ".white.inverse; | ||
output += " ".white.inverse; | ||
for (var col = 0; col < qrcode.getModuleCount(); col++) { | ||
if (qrcode.isDark(row, col)) { | ||
str += " "; | ||
output += " "; | ||
} | ||
else { | ||
str += " ".white.inverse; | ||
output += " ".white.inverse; | ||
} | ||
} | ||
str += " ".white.inverse; | ||
console.log(str); | ||
output += " ".white.inverse + "\n"; | ||
} | ||
console.log(border); | ||
output += border; | ||
if (cb) cb(output); | ||
else console.log(output); | ||
} | ||
}; |
{ | ||
"name": "qrcode-terminal", | ||
"keywords": ["ansi", "ascii", "qrcode", "console"], | ||
"version" : "0.3.0", | ||
"version" : "0.4.0", | ||
"description" : "QRCodes, in the terminal", | ||
"homepage": "https://github.com/gtanner/qrcode-terminal", | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/gtanner/qrcode-terminal" | ||
}, | ||
"contributors": [{ | ||
@@ -22,3 +26,11 @@ "name": "Gord Tanner", | ||
"colors": "*" | ||
}, | ||
"devDependencies": { | ||
"sinon": "*", | ||
"mocha": "*", | ||
"expect.js": "*" | ||
}, | ||
"scripts": { | ||
"test": "node example/basic.js && ./node_modules/mocha/bin/mocha -R nyan" | ||
} | ||
} |
@@ -18,4 +18,14 @@ # QRCode Terminal Edition | ||
qrcode.render("This will be a QRCode Eh!"); | ||
qrcode.generate("This will be a QRCode Eh!"); | ||
If you don't want to display to the terminal but just want to string you can provide a callback: | ||
qrcode.generate("http://www.github.com", function (qrcode) { }); | ||
# Developing | ||
To setup the development envrionment run `npm install` | ||
To run tests run `npm test` | ||
# Contributers: | ||
@@ -22,0 +32,0 @@ |
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
No repository
Supply chain riskPackage does not have a linked source code repository. Without this field, a package will have no reference to the location of the source code use to generate the package.
Found 1 instance in 1 package
42501
17
1020
34
0
3