1 | "use strict";
|
2 | Object.defineProperty(exports, "__esModule", { value: true });
|
3 | exports.isPromise = exports.isInjectable = exports.isRegExp = exports.isDate = exports.isArray = exports.isObject = exports.isString = exports.isNumber = exports.isFunction = exports.isNullOrUndefined = exports.isNull = exports.isDefined = exports.isUndefined = void 0;
|
4 |
|
5 |
|
6 |
|
7 |
|
8 |
|
9 |
|
10 |
|
11 |
|
12 | var hof_1 = require("./hof");
|
13 | var toStr = Object.prototype.toString;
|
14 | var tis = function (t) { return function (x) { return typeof x === t; }; };
|
15 | exports.isUndefined = tis('undefined');
|
16 | exports.isDefined = hof_1.not(exports.isUndefined);
|
17 | exports.isNull = function (o) { return o === null; };
|
18 | exports.isNullOrUndefined = hof_1.or(exports.isNull, exports.isUndefined);
|
19 | exports.isFunction = tis('function');
|
20 | exports.isNumber = tis('number');
|
21 | exports.isString = tis('string');
|
22 | exports.isObject = function (x) { return x !== null && typeof x === 'object'; };
|
23 | exports.isArray = Array.isArray;
|
24 | exports.isDate = (function (x) { return toStr.call(x) === '[object Date]'; });
|
25 | exports.isRegExp = (function (x) { return toStr.call(x) === '[object RegExp]'; });
|
26 |
|
27 |
|
28 |
|
29 |
|
30 |
|
31 |
|
32 | function isInjectable(val) {
|
33 | if (exports.isArray(val) && val.length) {
|
34 | var head = val.slice(0, -1), tail = val.slice(-1);
|
35 | return !(head.filter(hof_1.not(exports.isString)).length || tail.filter(hof_1.not(exports.isFunction)).length);
|
36 | }
|
37 | return exports.isFunction(val);
|
38 | }
|
39 | exports.isInjectable = isInjectable;
|
40 |
|
41 |
|
42 |
|
43 |
|
44 |
|
45 | exports.isPromise = hof_1.and(exports.isObject, hof_1.pipe(hof_1.prop('then'), exports.isFunction));
|
46 |
|
\ | No newline at end of file |