Build NapCat Artifacts / Windows Loader Test (push) Canceled after 0s
Build NapCat Artifacts / Type Check & Test (push) Canceled after 0s
Build NapCat Artifacts / Build NapCat.Framework (push) Canceled after 0s
Build NapCat Artifacts / Build NapCat.Shell (push) Canceled after 0s
98 lines
3.2 KiB
Plaintext
98 lines
3.2 KiB
Plaintext
(function(global, factory) {
|
|
typeof exports === "object" && typeof module !== "undefined" ? factory(exports) : typeof define === "function" && define.amd ? define(["exports"], factory) : (global = typeof globalThis !== "undefined" ? globalThis : global || self, factory(global.IsWhatType = {}));
|
|
})(this, function(exports2) {
|
|
"use strict";
|
|
function ensureType(value, checked) {
|
|
return checked;
|
|
}
|
|
function getType(value) {
|
|
return Object.prototype.toString.call(value).slice(8, -1);
|
|
}
|
|
const PROTOCOL = /^([a-z][a-z\d+\-.]*:)?\/\//i;
|
|
function isAbsoluteURL(value) {
|
|
return PROTOCOL.test(value);
|
|
}
|
|
function isLength(value) {
|
|
return Number.isInteger(value) && value > -1;
|
|
}
|
|
function isArrayLike(value) {
|
|
return value != null && isLength(value.length) && typeof value !== "function";
|
|
}
|
|
function isAsyncFunction(value) {
|
|
return getType(value) === "AsyncFunction";
|
|
}
|
|
function isObject(value) {
|
|
return value !== null && typeof value === "object";
|
|
}
|
|
const hasSymbol = typeof Symbol === "function" && typeof Symbol.toStringTag === "symbol";
|
|
function isESModule(value) {
|
|
return isObject(value) && (value.__esModule || hasSymbol && value[Symbol.toStringTag] === "Module");
|
|
}
|
|
function isError(value) {
|
|
if (value == null) {
|
|
return false;
|
|
}
|
|
if (value instanceof Error) {
|
|
return true;
|
|
}
|
|
const { name } = value;
|
|
return typeof name === "string" && name.endsWith("Error");
|
|
}
|
|
function isFunction(value) {
|
|
return typeof value === "function";
|
|
}
|
|
function isIterable(value) {
|
|
return value != null && typeof value[Symbol.iterator] === "function";
|
|
}
|
|
function isNumber(value) {
|
|
return typeof value === "number" && value === value;
|
|
}
|
|
function isValidDate(value) {
|
|
return value instanceof Date && value.toString() !== "Invalid Date";
|
|
}
|
|
function isLeapYear(value) {
|
|
let year = value;
|
|
if (isValidDate(value)) {
|
|
year = value.getFullYear();
|
|
} else if (!isNumber(value)) {
|
|
return false;
|
|
}
|
|
return year % 4 === 0 && year % 100 !== 0 || year % 400 === 0;
|
|
}
|
|
function isNil(value) {
|
|
return value == null;
|
|
}
|
|
function isPlainObject(value) {
|
|
if (!isObject(value) || getType(value) !== "Object") {
|
|
return false;
|
|
}
|
|
const prototype = Object.getPrototypeOf(value);
|
|
return prototype === null || prototype === Object.prototype;
|
|
}
|
|
function isPromiseLike(value) {
|
|
return isObject(value) && typeof value.then === "function";
|
|
}
|
|
function isWhat(value, type, comparingType) {
|
|
return type === comparingType;
|
|
}
|
|
exports2.ensureType = ensureType;
|
|
exports2.getType = getType;
|
|
exports2.isAbsoluteURL = isAbsoluteURL;
|
|
exports2.isArrayLike = isArrayLike;
|
|
exports2.isAsyncFunction = isAsyncFunction;
|
|
exports2.isESModule = isESModule;
|
|
exports2.isError = isError;
|
|
exports2.isFunction = isFunction;
|
|
exports2.isIterable = isIterable;
|
|
exports2.isLeapYear = isLeapYear;
|
|
exports2.isLength = isLength;
|
|
exports2.isNil = isNil;
|
|
exports2.isNumber = isNumber;
|
|
exports2.isObject = isObject;
|
|
exports2.isPlainObject = isPlainObject;
|
|
exports2.isPromiseLike = isPromiseLike;
|
|
exports2.isValidDate = isValidDate;
|
|
exports2.isWhat = isWhat;
|
|
Object.defineProperty(exports2, Symbol.toStringTag, { value: "Module" });
|
|
});
|