rockdai / sql-bricks

Transparent, Schemaless SQL Generation
http://csnw.github.io/sql-bricks
MIT License
213 stars 25 forks source link

Rhino support #68

Closed prust closed 9 years ago

prust commented 9 years ago

Stefan Klöckner sent a patch to allow this to run on Rhino

diff --git a/api/javascripts/sql-bricks.js b/api/javascripts/sql-bricks.js
index d0b42ca..0a920df 100755
--- a/api/javascripts/sql-bricks.js
+++ b/api/javascripts/sql-bricks.js
@@ -2,11 +2,10 @@
   "use strict";

   var is_common_js = typeof exports != 'undefined';
-  
-  var _;
+
   if (is_common_js)
     _ = require('underscore');
-  else
+  else if (typeof window !== "undefined")
     _ = window._;

   // sql() wrapper allows SQL (column/table/etc) where a value (string/number/etc) is expected
@@ -1022,7 +1021,8 @@

   if (is_common_js)
     module.exports = sql;
-  else
+  else if (typeof window !== "undefined")
     window.SqlBricks = sql;
-
+  else
+    SqlBricks = sql
 })();

Rhino support isn't a huge priority to me, but if someone wants to convert this diff into a pull request (or if I have the time & do it) then I don't have a problem with accepting it.

prust commented 9 years ago

Closing, as there hasn't been any additional demand