1 | "use strict";
|
2 | Object.defineProperty(exports, "__esModule", { value: true });
|
3 | exports.isSymbol = exports.isEmpty = exports.isNil = exports.isConstructor = exports.isString = exports.isFunction = exports.validatePath = exports.addLeadingSlash = exports.isPlainObject = exports.isObject = exports.isUndefined = void 0;
|
4 |
|
5 | const isUndefined = (obj) => typeof obj === 'undefined';
|
6 | exports.isUndefined = isUndefined;
|
7 | const isObject = (fn) => !exports.isNil(fn) && typeof fn === 'object';
|
8 | exports.isObject = isObject;
|
9 | const isPlainObject = (fn) => {
|
10 | if (!exports.isObject(fn)) {
|
11 | return false;
|
12 | }
|
13 | const proto = Object.getPrototypeOf(fn);
|
14 | if (proto === null) {
|
15 | return true;
|
16 | }
|
17 | const ctor = Object.prototype.hasOwnProperty.call(proto, 'constructor') &&
|
18 | proto.constructor;
|
19 | return (typeof ctor === 'function' &&
|
20 | ctor instanceof ctor &&
|
21 | Function.prototype.toString.call(ctor) ===
|
22 | Function.prototype.toString.call(Object));
|
23 | };
|
24 | exports.isPlainObject = isPlainObject;
|
25 | const addLeadingSlash = (path) => path ? (path.charAt(0) !== '/' ? '/' + path : path) : '';
|
26 | exports.addLeadingSlash = addLeadingSlash;
|
27 |
|
28 |
|
29 |
|
30 |
|
31 | exports.validatePath = exports.addLeadingSlash;
|
32 | const isFunction = (fn) => typeof fn === 'function';
|
33 | exports.isFunction = isFunction;
|
34 | const isString = (fn) => typeof fn === 'string';
|
35 | exports.isString = isString;
|
36 | const isConstructor = (fn) => fn === 'constructor';
|
37 | exports.isConstructor = isConstructor;
|
38 | const isNil = (obj) => exports.isUndefined(obj) || obj === null;
|
39 | exports.isNil = isNil;
|
40 | const isEmpty = (array) => !(array && array.length > 0);
|
41 | exports.isEmpty = isEmpty;
|
42 | const isSymbol = (fn) => typeof fn === 'symbol';
|
43 | exports.isSymbol = isSymbol;
|