@modern-js/utils
Version:
A Progressive React Framework for modern web development.
85 lines (84 loc) • 2.72 kB
JavaScript
;
var __webpack_require__ = {};
(()=>{
__webpack_require__.d = (exports1, definition)=>{
for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
enumerable: true,
get: definition[key]
});
};
})();
(()=>{
__webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
})();
(()=>{
__webpack_require__.r = (exports1)=>{
if ("u" > typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
value: 'Module'
});
Object.defineProperty(exports1, '__esModule', {
value: true
});
};
})();
var __webpack_exports__ = {};
__webpack_require__.r(__webpack_exports__);
__webpack_require__.d(__webpack_exports__, {
isArray: ()=>isArray,
isEmpty: ()=>isEmpty,
isFunction: ()=>isFunction,
isObject: ()=>isObject,
isPlainObject: ()=>isPlainObject,
isPromise: ()=>isPromise,
isRegExp: ()=>isRegExp,
isString: ()=>isString,
isUndefined: ()=>isUndefined
});
function isString(str) {
return 'string' == typeof str;
}
function isUndefined(obj) {
return void 0 === obj;
}
function isArray(obj) {
return Array.isArray(obj);
}
function isFunction(func) {
return 'function' == typeof func;
}
function isObject(obj) {
return null !== obj && 'object' == typeof obj;
}
function isPlainObject(obj) {
return isObject(obj) && '[object Object]' === Object.prototype.toString.call(obj);
}
function isPromise(obj) {
return Boolean(obj) && ('object' == typeof obj || 'function' == typeof obj) && 'function' == typeof obj.then;
}
function isRegExp(obj) {
return '[object RegExp]' === Object.prototype.toString.call(obj);
}
const isEmpty = (o)=>0 === Object.entries(o).length && o.constructor === Object;
exports.isArray = __webpack_exports__.isArray;
exports.isEmpty = __webpack_exports__.isEmpty;
exports.isFunction = __webpack_exports__.isFunction;
exports.isObject = __webpack_exports__.isObject;
exports.isPlainObject = __webpack_exports__.isPlainObject;
exports.isPromise = __webpack_exports__.isPromise;
exports.isRegExp = __webpack_exports__.isRegExp;
exports.isString = __webpack_exports__.isString;
exports.isUndefined = __webpack_exports__.isUndefined;
for(var __rspack_i in __webpack_exports__)if (-1 === [
"isArray",
"isEmpty",
"isFunction",
"isObject",
"isPlainObject",
"isPromise",
"isRegExp",
"isString",
"isUndefined"
].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
Object.defineProperty(exports, '__esModule', {
value: true
});