-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
42 lines (35 loc) · 1.1 KB
/
index.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
42
// jscs:disable validateIndentation
/*!
Copyright (c) 2015 Andrew Gurinovich.
Licensed under the MIT License (MIT)
*/
(function() {
'use strict';
function handlers(/* funcs */) {
var funcs = arguments;
return function(/* args */) {
var args = arguments,
that = this;
Array.prototype.forEach.call(funcs, function(obj) {
if (typeof obj == 'function') {
obj.apply(that, args);
} else {
if (typeof(obj) != 'undefined') {
throw new Error('handlers accepts only functions and undefined values');
}
}
});
};
return result;
}
if (typeof define === 'function' && typeof define.amd === 'object' && define.amd) {
// AMD. Register as an anonymous module.
define(function() {
return handlers;
});
} else if (typeof module !== 'undefined' && module.exports) {
module.exports = handlers;
} else {
window.reactHandlers = handlers;
}
}());