qrcode-terminal
Advanced tools
Comparing version 0.9.5 to 0.10.0
@@ -17,4 +17,7 @@ var QRCode = require('./../vendor/QRCode'), | ||
module.exports = { | ||
error: QRErrorCorrectLevel.L, | ||
generate: function (input, cb) { | ||
var qrcode = new QRCode(-1, QRErrorCorrectLevel.H); | ||
var qrcode = new QRCode(-1, this.error); | ||
qrcode.addData(input); | ||
@@ -36,3 +39,8 @@ qrcode.make(); | ||
else console.log(output); | ||
}, | ||
setErrorLevel: function (error) { | ||
this.error = QRErrorCorrectLevel[error] || this.error; | ||
} | ||
}; |
{ | ||
"name": "qrcode-terminal", | ||
"keywords": ["ansi", "ascii", "qrcode", "console"], | ||
"version" : "0.9.5", | ||
"version" : "0.10.0", | ||
"description" : "QRCodes, in the terminal", | ||
@@ -6,0 +6,0 @@ "homepage": "https://github.com/gtanner/qrcode-terminal", |
@@ -25,2 +25,7 @@ # QRCode Terminal Edition [![Build Status][travis-ci-img]][travis-ci-url] | ||
You can even specify the error level (default is 'L'): | ||
qrcode.setErrorLevel('Q'); | ||
qrcode.generate('This will be a QRCode with error level Q!'); | ||
If you don't want to display to the terminal but just want to string you can provide a callback: | ||
@@ -27,0 +32,0 @@ |
@@ -51,3 +51,14 @@ var expect = require('expect.js'), | ||
}); | ||
describe('the error level', function () { | ||
it('should default to 1', function() { | ||
expect(qrcode.error).to.be(1); | ||
}); | ||
it('should not allow other levels', function() { | ||
qrcode.setErrorLevel = 'something'; | ||
expect(qrcode.error).to.be(1); | ||
}); | ||
}); | ||
}); | ||
}); |
Sorry, the diff of this file is not supported yet
93449
1104
74