Permalink
Browse files

less `new` madness

so you can do `var negotiator = Negotiator(request)` without the `new`
  • Loading branch information...
1 parent a42995c commit 4db66c4e80de4cee4dafbcb7695db6b51b64d077 @jonathanong jonathanong committed Oct 17, 2013
Showing with 1 addition and 0 deletions.
  1. +1 −0 lib/negotiator.js
View
@@ -2,6 +2,7 @@ module.exports = Negotiator;
Negotiator.Negotiator = Negotiator;
function Negotiator(request) {
+ if (!(this instanceof Negotiator)) return new Negotiator(request);
this.request = request;
}

0 comments on commit 4db66c4

Please sign in to comment.