Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Updated to allow use as a node or commonJS module

  • Loading branch information...
commit 63e3f81865056ae3200fe078199891bba1f3899f 1 parent 7f2a278
@swbiggart swbiggart authored jfirebaugh committed
Showing with 18 additions and 2 deletions.
  1. +18 −2 chai-jquery.js
View
20 chai-jquery.js
@@ -1,4 +1,19 @@
-chai.use(function (chai) {
+(function (chai_jquery) {
+ // Module systems magic dance.
+ if (typeof require === "function" && typeof exports === "object" && typeof module === "object") {
+ // NodeJS
+ module.exports = chai_jquery;
+ } else if (typeof define === "function" && define.amd) {
+ // AMD
+ define(function () {
+ return chai_jquery;
+ });
+ } else {
+ // Other environment (usually <script> tag): pass into global chai
+ var global = (false || eval)("this");
+ global.chai.use(chai_jquery);
+ }
+}(function chai_jquery(chai) {
var inspect = chai.inspect;
jQuery.fn.inspect = function (depth) {
@@ -169,4 +184,5 @@ chai.use(function (chai) {
return contain;
}
});
-});
+}));
+
Please sign in to comment.
Something went wrong with that request. Please try again.