1 | var _isArray =
|
2 |
|
3 | require("./_isArray");
|
4 |
|
5 |
|
6 |
|
7 |
|
8 |
|
9 |
|
10 |
|
11 |
|
12 |
|
13 |
|
14 |
|
15 |
|
16 | function _checkForMethod(methodname, fn) {
|
17 | return function () {
|
18 | var length = arguments.length;
|
19 |
|
20 | if (length === 0) {
|
21 | return fn();
|
22 | }
|
23 |
|
24 | var obj = arguments[length - 1];
|
25 | return _isArray(obj) || typeof obj[methodname] !== 'function' ? fn.apply(this, arguments) : obj[methodname].apply(obj, Array.prototype.slice.call(arguments, 0, length - 1));
|
26 | };
|
27 | }
|
28 |
|
29 | module.exports = _checkForMethod; |
\ | No newline at end of file |