Skip to content

Commit

Permalink
Redesign UMD code to allow imports
Browse files Browse the repository at this point in the history
  • Loading branch information
lddubeau authored and domenic committed Sep 27, 2016
1 parent 823c15b commit e425136
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions lib/chai-as-promised.js
Original file line number Diff line number Diff line change
@@ -1,26 +1,24 @@
(function () {
(function (factory) {
"use strict";

// Module systems magic dance.

/* istanbul ignore else */
if (typeof require === "function" && typeof exports === "object" && typeof module === "object") {
// NodeJS
module.exports = chaiAsPromised;
module.exports = factory();
} else if (typeof define === "function" && define.amd) {
// AMD
define(function () {
return chaiAsPromised;
});
define(factory);
} else {
/*global self: false */

// Other environment (usually <script> tag): plug in to global chai instance directly.
var chaiAsPromised = factory();
chai.use(chaiAsPromised);

// Expose as a property of the global object so that consumers can configure the `transferPromiseness` property.
self.chaiAsPromised = chaiAsPromised;
}
}(function () {
"use strict";

chaiAsPromised.transferPromiseness = function (assertion, promise) {
assertion.then = promise.then.bind(promise);
Expand Down Expand Up @@ -371,4 +369,6 @@
};
});
}
}());

return chaiAsPromised;
}));

0 comments on commit e425136

Please sign in to comment.