-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlaughingwookie.js
41 lines (36 loc) · 1.19 KB
/
laughingwookie.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
(function (root, slice) {
"use strict";
var
isFunction = function (arg) {
return (typeof arg === 'function');
},
bdd = function () {
var _current,
_block = function (func) {
var args = slice.call(arguments, 1);
var array = [_current].concat(args);
_current = (func.apply(this, array) || _current);
return this;
};
return {
"GIVEN": function (arg) {
var args = slice.call(arguments, 1);
_current = (!isFunction(arg) ? arg : arg.apply(this, args));
return this;
},
"WHEN": _block,
"THEN": _block,
"AND": _block
}
};
//expose
if (typeof module === 'object' && typeof define !== 'function') { // CommonJS
module.exports = bdd;
} else if (typeof define === "function" && define.amd ) { // AMD
define("bdd", [], function () {
return bdd;
});
} else { // browser global
root.bdd = bdd;
}
}(this, Array.prototype.slice));