Permalink
Browse files

Allow invoking of Parser() directly

  • Loading branch information...
1 parent 63e7e28 commit ba0d5b6d1c3b6ef99a978162be0dc48d5410c62c @tj committed Mar 21, 2012
Showing with 7 additions and 0 deletions.
  1. +1 −0 lib/Parser.js
  2. +6 −0 test/parser.js
View
@@ -18,6 +18,7 @@ module.exports = Parser;
*/
function Parser() {
+ if (!(this instanceof Parser)) return new Parser;
this.plugins = [];
}
View
@@ -2,6 +2,12 @@
var Parser = require('../');
describe('Parser', function(){
+ describe('Parser()', function(){
+ it('should return a new Parser', function(){
+ Parser().should.be.an.instanceof(Parser);
+ })
+ })
+
describe('.use(fn)', function(){
it('should be invoked with both the key and value', function(done){
var parser = new Parser;

0 comments on commit ba0d5b6

Please sign in to comment.