qrcode-terminal
Advanced tools
Comparing version 0.7.0 to 0.8.0
@@ -23,10 +23,10 @@ var QRCode = require('./../vendor/QRCode'), | ||
var output = "", | ||
border = repeat(white).times(qrcode.getModuleCount() + 3) + "\n"; | ||
var output = '', | ||
border = repeat(white).times(qrcode.getModuleCount() + 3); | ||
output += border; | ||
output += border + '\n'; | ||
qrcode.modules.forEach(function (row) { | ||
output += white; | ||
output += row.map(toCell).join(''); | ||
output += white + "\n"; | ||
output += white + '\n'; | ||
}); | ||
@@ -33,0 +33,0 @@ output += border; |
{ | ||
"name": "qrcode-terminal", | ||
"keywords": ["ansi", "ascii", "qrcode", "console"], | ||
"version" : "0.7.0", | ||
"version" : "0.8.0", | ||
"description" : "QRCodes, in the terminal", | ||
@@ -21,3 +21,3 @@ "homepage": "https://github.com/gtanner/qrcode-terminal", | ||
"licenses": [{ | ||
"type": "Apache" | ||
"type": "Apache 2.0" | ||
}], | ||
@@ -24,0 +24,0 @@ "main": "./lib/main", |
# QRCode Terminal Edition [![Build Status][travis-ci-img]][travis-ci-url] | ||
Going where no QRCode has gone before. | ||
> Going where no QRCode has gone before. | ||
![Basic Example][basic-example-img] | ||
# Install | ||
@@ -18,7 +21,9 @@ | ||
qrcode.generate("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) { }); | ||
qrcode.generate('http://www.github.com', function (qrcode) { | ||
console.log(qrcode); | ||
}); | ||
@@ -34,6 +39,7 @@ # Developing | ||
Gord Tanner <gtanner@gmail.com> | ||
Micheal Brooks <mikeywbrooks@gmail.com> | ||
Micheal Brooks <michael@michaelbrooks.ca> | ||
[travis-ci-img]: https://travis-ci.org/gtanner/qrcode-terminal.png | ||
[travis-ci-url]: https://travis-ci.org/gtanner/qrcode-terminal | ||
[basic-example-img]: https://raw.github.com/gtanner/qrcode-terminal/master/example/basic.png | ||
@@ -1,10 +0,10 @@ | ||
var expect = require("expect.js"), | ||
var expect = require('expect.js'), | ||
qrcode = require('./../lib/main'), | ||
sinon = require("sinon"); | ||
sinon = require('sinon'); | ||
describe('in the main module', function() { | ||
describe("the generate method", function () { | ||
describe("when not providing a callback", function () { | ||
describe('the generate method', function () { | ||
describe('when not providing a callback', function () { | ||
beforeEach(function () { | ||
sinon.stub(console, "log"); | ||
sinon.stub(console, 'log'); | ||
}); | ||
@@ -17,4 +17,4 @@ | ||
it("logs to the console", function () { | ||
qrcode.generate("test"); | ||
it('logs to the console', function () { | ||
qrcode.generate('test'); | ||
expect(console.log.called).to.be(true); | ||
@@ -24,15 +24,31 @@ }); | ||
describe("when providing a callback", function () { | ||
it("will call the callback", function () { | ||
describe('when providing a callback', function () { | ||
it('will call the callback', function () { | ||
var cb = sinon.spy(); | ||
qrcode.generate("test", cb); | ||
qrcode.generate('test', cb); | ||
expect(cb.called).to.be(true); | ||
}); | ||
it("will not call the console.log method", function () { | ||
qrcode.generate("test", sinon.spy()); | ||
it('will not call the console.log method', function () { | ||
qrcode.generate('test', sinon.spy()); | ||
expect(console.log.called).to.be(false); | ||
}); | ||
}); | ||
describe('the QR Code', function () { | ||
it('should be a string', function (done) { | ||
qrcode.generate('test', function(result) { | ||
expect(result).to.be.a('string'); | ||
done(); | ||
}); | ||
}); | ||
it('should not end with a newline', function (done) { | ||
qrcode.generate('test', function(result) { | ||
expect(result).not.to.match(/\n$/); | ||
done(); | ||
}); | ||
}); | ||
}); | ||
}); | ||
}); |
90002
20
1043
44