Permalink
Browse files

Remove global variables used for environment detection.

  • Loading branch information...
1 parent 0b4e1ac commit ab49a0bb0e01a826bf1fc4d9f042bae9bbe2cbc6 @scottgonzalez scottgonzalez committed May 5, 2010
Showing with 3 additions and 16 deletions.
  1. +3 −16 lib/JSLINQ.js
View
@@ -6,21 +6,8 @@
//-----------------------------------------------------------------------
// Modfications by Marak Squires (C) 2010, MIT
-// little hack for making window turn into exports for node.js, thanks isaacs
-var isBrowser = function () { return this.window === this };
-
-if(!isBrowser()){
- window = exports;
- // namespace for CommonJS export of top level JSLINQ method
- var namespace = "Exec";
-}
-else{
- //sigh polute the global namespace
- var namespace = "JSLINQ";
-}
-
-(function() {
- JSLINQ = window[namespace] = function(dataItems) {
+(function(window, namespace) {
+ var JSLINQ = window[namespace] = function(dataItems) {
if (!(this instanceof JSLINQ)) {
return new JSLINQ(dataItems);
}
@@ -198,4 +185,4 @@ else{
return this.Last() || defaultValue;
}
};
-})();
+})(this.window || exports, this.window === this ? "JSLINQ" : "Exec");

0 comments on commit ab49a0b

Please sign in to comment.