@stryke/type-checks 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (132) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +63 -0
  3. package/dist/get-object-tag.cjs +8 -0
  4. package/dist/get-object-tag.d.ts +7 -0
  5. package/dist/get-object-tag.mjs +1 -0
  6. package/dist/index.cjs +456 -0
  7. package/dist/index.d.ts +49 -0
  8. package/dist/index.mjs +1 -0
  9. package/dist/is-array-like.cjs +11 -0
  10. package/dist/is-array-like.d.ts +7 -0
  11. package/dist/is-array-like.mjs +1 -0
  12. package/dist/is-async-iterable.cjs +10 -0
  13. package/dist/is-async-iterable.d.ts +7 -0
  14. package/dist/is-async-iterable.mjs +1 -0
  15. package/dist/is-bigint.cjs +9 -0
  16. package/dist/is-bigint.d.ts +16 -0
  17. package/dist/is-bigint.mjs +1 -0
  18. package/dist/is-boolean.cjs +14 -0
  19. package/dist/is-boolean.d.ts +7 -0
  20. package/dist/is-boolean.mjs +1 -0
  21. package/dist/is-buffer.cjs +10 -0
  22. package/dist/is-buffer.d.ts +5 -0
  23. package/dist/is-buffer.mjs +1 -0
  24. package/dist/is-collection.cjs +11 -0
  25. package/dist/is-collection.d.ts +8 -0
  26. package/dist/is-collection.mjs +1 -0
  27. package/dist/is-date.cjs +10 -0
  28. package/dist/is-date.d.ts +16 -0
  29. package/dist/is-date.mjs +1 -0
  30. package/dist/is-deep-key.cjs +26 -0
  31. package/dist/is-deep-key.d.ts +35 -0
  32. package/dist/is-deep-key.mjs +1 -0
  33. package/dist/is-empty-object.cjs +23 -0
  34. package/dist/is-empty-object.d.ts +14 -0
  35. package/dist/is-empty-object.mjs +1 -0
  36. package/dist/is-empty-string.cjs +16 -0
  37. package/dist/is-empty-string.d.ts +7 -0
  38. package/dist/is-empty-string.mjs +1 -0
  39. package/dist/is-empty.cjs +35 -0
  40. package/dist/is-empty.d.ts +8 -0
  41. package/dist/is-empty.mjs +1 -0
  42. package/dist/is-equal.cjs +18 -0
  43. package/dist/is-equal.d.ts +1 -0
  44. package/dist/is-equal.mjs +1 -0
  45. package/dist/is-error.cjs +15 -0
  46. package/dist/is-error.d.ts +17 -0
  47. package/dist/is-error.mjs +1 -0
  48. package/dist/is-file-result.cjs +11 -0
  49. package/dist/is-file-result.d.ts +8 -0
  50. package/dist/is-file-result.mjs +1 -0
  51. package/dist/is-float.cjs +9 -0
  52. package/dist/is-float.d.ts +8 -0
  53. package/dist/is-float.mjs +1 -0
  54. package/dist/is-function.cjs +23 -0
  55. package/dist/is-function.d.ts +10 -0
  56. package/dist/is-function.mjs +1 -0
  57. package/dist/is-integer.cjs +10 -0
  58. package/dist/is-integer.d.ts +8 -0
  59. package/dist/is-integer.mjs +1 -0
  60. package/dist/is-mergeable-object.cjs +14 -0
  61. package/dist/is-mergeable-object.d.ts +1 -0
  62. package/dist/is-mergeable-object.mjs +1 -0
  63. package/dist/is-non-null-object.cjs +10 -0
  64. package/dist/is-non-null-object.d.ts +7 -0
  65. package/dist/is-non-null-object.mjs +1 -0
  66. package/dist/is-not-empty.cjs +17 -0
  67. package/dist/is-not-empty.d.ts +7 -0
  68. package/dist/is-not-empty.mjs +1 -0
  69. package/dist/is-null.cjs +14 -0
  70. package/dist/is-null.d.ts +1 -0
  71. package/dist/is-null.mjs +1 -0
  72. package/dist/is-number.cjs +19 -0
  73. package/dist/is-number.d.ts +15 -0
  74. package/dist/is-number.mjs +1 -0
  75. package/dist/is-object-index.cjs +17 -0
  76. package/dist/is-object-index.d.ts +7 -0
  77. package/dist/is-object-index.mjs +1 -0
  78. package/dist/is-object.cjs +30 -0
  79. package/dist/is-object.d.ts +30 -0
  80. package/dist/is-object.mjs +1 -0
  81. package/dist/is-plain-object.cjs +17 -0
  82. package/dist/is-plain-object.d.ts +50 -0
  83. package/dist/is-plain-object.mjs +1 -0
  84. package/dist/is-primitive.cjs +14 -0
  85. package/dist/is-primitive.d.ts +1 -0
  86. package/dist/is-primitive.mjs +1 -0
  87. package/dist/is-promise.cjs +12 -0
  88. package/dist/is-promise.d.ts +17 -0
  89. package/dist/is-promise.mjs +1 -0
  90. package/dist/is-react-element.cjs +8 -0
  91. package/dist/is-react-element.d.ts +1 -0
  92. package/dist/is-react-element.mjs +1 -0
  93. package/dist/is-ref.cjs +14 -0
  94. package/dist/is-ref.d.ts +8 -0
  95. package/dist/is-ref.mjs +1 -0
  96. package/dist/is-regexp.cjs +10 -0
  97. package/dist/is-regexp.d.ts +16 -0
  98. package/dist/is-regexp.mjs +1 -0
  99. package/dist/is-select-option.cjs +15 -0
  100. package/dist/is-select-option.d.ts +8 -0
  101. package/dist/is-select-option.mjs +1 -0
  102. package/dist/is-set-object.cjs +15 -0
  103. package/dist/is-set-object.d.ts +7 -0
  104. package/dist/is-set-object.mjs +1 -0
  105. package/dist/is-set-string.cjs +16 -0
  106. package/dist/is-set-string.d.ts +7 -0
  107. package/dist/is-set-string.mjs +1 -0
  108. package/dist/is-set.cjs +15 -0
  109. package/dist/is-set.d.ts +7 -0
  110. package/dist/is-set.mjs +1 -0
  111. package/dist/is-string.cjs +14 -0
  112. package/dist/is-string.d.ts +1 -0
  113. package/dist/is-string.mjs +1 -0
  114. package/dist/is-symbol.cjs +14 -0
  115. package/dist/is-symbol.d.ts +1 -0
  116. package/dist/is-symbol.mjs +1 -0
  117. package/dist/is-typed-array.cjs +9 -0
  118. package/dist/is-typed-array.d.ts +1 -0
  119. package/dist/is-typed-array.mjs +1 -0
  120. package/dist/is-typed.cjs +16 -0
  121. package/dist/is-typed.d.ts +8 -0
  122. package/dist/is-typed.mjs +1 -0
  123. package/dist/is-undefined.cjs +8 -0
  124. package/dist/is-undefined.d.ts +1 -0
  125. package/dist/is-undefined.mjs +1 -0
  126. package/dist/property-exists.cjs +17 -0
  127. package/dist/property-exists.d.ts +16 -0
  128. package/dist/property-exists.mjs +1 -0
  129. package/dist/type-detect.cjs +38 -0
  130. package/dist/type-detect.d.ts +1 -0
  131. package/dist/type-detect.mjs +1 -0
  132. package/package.json +667 -0
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.isPlainObject = exports.isObjectLike = void 0;
7
+ var _getObjectTag = require("./get-object-tag.cjs");
8
+ const isObjectLike = t => typeof t == "object" && t !== null,
9
+ isPlainObject = t => {
10
+ if (!isObjectLike(t) || (0, _getObjectTag.getObjectTag)(t) !== "[object Object]") return !1;
11
+ if (Object.getPrototypeOf(t) === null) return !0;
12
+ let e = t;
13
+ for (; Object.getPrototypeOf(e) !== null;) e = Object.getPrototypeOf(e);
14
+ return Object.getPrototypeOf(t) === e;
15
+ };
16
+ exports.isPlainObject = isPlainObject;
17
+ exports.isObjectLike = isObjectLike;
@@ -0,0 +1,50 @@
1
+ import { PlainObject } from "@stryke/types/base";
2
+ /**
3
+ * Checks if `value` is object-like. A value is object-like if it's not `null`
4
+ * and has a `typeof` result of "object".
5
+ *
6
+ * @example
7
+ * ```typescript
8
+ * isObjectLike({})
9
+ * // => true
10
+ *
11
+ * isObjectLike([1, 2, 3])
12
+ * // => true
13
+ *
14
+ * isObjectLike(Function)
15
+ * // => false
16
+ *
17
+ * isObjectLike(null)
18
+ * // => false
19
+ * ```
20
+ *
21
+ * @param value - The value to check.
22
+ * @returns Returns `true` if `value` is object-like, else `false`.
23
+ */
24
+ export declare const isObjectLike: (obj: unknown) => obj is object;
25
+ /**
26
+ * Checks if `obj` is a plain object, that is, an object created by the `Object` constructor or one with a `[[Prototype]]` of `null`.
27
+ *
28
+ * @example
29
+ * ```typescript
30
+ * function Foo() {
31
+ * this.a = 1
32
+ * }
33
+ *
34
+ * isPlainObject(new Foo)
35
+ * // => false
36
+ *
37
+ * isPlainObject([1, 2, 3])
38
+ * // => false
39
+ *
40
+ * isPlainObject({ 'x': 0, 'y': 0 })
41
+ * // => true
42
+ *
43
+ * isPlainObject(Object.create(null))
44
+ * // => true
45
+ * ```
46
+ *
47
+ * @param obj - The value to check.
48
+ * @returns Returns `true` if `obj` is a plain object, else `false`.
49
+ */
50
+ export declare const isPlainObject: (obj: unknown) => obj is PlainObject;
@@ -0,0 +1 @@
1
+ import{getObjectTag as r}from"./get-object-tag";export const isObjectLike=t=>typeof t=="object"&&t!==null,isPlainObject=t=>{if(!isObjectLike(t)||r(t)!=="[object Object]")return!1;if(Object.getPrototypeOf(t)===null)return!0;let e=t;for(;Object.getPrototypeOf(e)!==null;)e=Object.getPrototypeOf(e);return Object.getPrototypeOf(t)===e};
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.isPrimitive = void 0;
7
+ const isPrimitive = n => {
8
+ try {
9
+ return n == null || typeof n != "object" && typeof n != "function";
10
+ } catch {
11
+ return !1;
12
+ }
13
+ };
14
+ exports.isPrimitive = isPrimitive;
@@ -0,0 +1 @@
1
+ export declare const isPrimitive: (value: unknown) => boolean;
@@ -0,0 +1 @@
1
+ export const isPrimitive=n=>{try{return n==null||typeof n!="object"&&typeof n!="function"}catch{return!1}};
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.isPromiseLike = exports.isPromise = void 0;
7
+ var _isFunction = require("./is-function.cjs");
8
+ var _isObject = require("./is-object.cjs");
9
+ const isPromise = n => (0, _isObject.isObject)(n) && (0, _isFunction.isFunction)(n?.then),
10
+ isPromiseLike = n => typeof n?.then == "function";
11
+ exports.isPromiseLike = isPromiseLike;
12
+ exports.isPromise = isPromise;
@@ -0,0 +1,17 @@
1
+ /**
2
+ * Check if the provided value's type is a promise
3
+ *
4
+ * @param value - The value to type check
5
+ * @returns An indicator specifying if the object provided is of type a promise
6
+ */
7
+ export declare const isPromise: (value: unknown) => value is Promise<unknown>;
8
+ /**
9
+ * Check if the provided value's type is a promise-like
10
+ *
11
+ * @remarks
12
+ * A promise-like is an object that has a `then` function
13
+ *
14
+ * @param value - The value to type check
15
+ * @returns An indicator specifying if the object provided is of type a promise-like
16
+ */
17
+ export declare const isPromiseLike: (value: unknown) => value is PromiseLike<unknown>;
@@ -0,0 +1 @@
1
+ import{isFunction as o}from"./is-function";import{isObject as i}from"./is-object";export const isPromise=n=>i(n)&&o(n?.then),isPromiseLike=n=>typeof n?.then=="function";
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.isReactElement = void 0;
7
+ const isReactElement = e => e.$$typeof === (typeof Symbol == "function" && Symbol.for ? Symbol.for("react.element") : 60103);
8
+ exports.isReactElement = isReactElement;
@@ -0,0 +1 @@
1
+ export declare const isReactElement: (value: any) => boolean;
@@ -0,0 +1 @@
1
+ export const isReactElement=e=>e.$$typeof===(typeof Symbol=="function"&&Symbol.for?Symbol.for("react.element"):60103);
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.isRef = void 0;
7
+ const isRef = e => {
8
+ try {
9
+ return e?.current !== void 0;
10
+ } catch {
11
+ return !1;
12
+ }
13
+ };
14
+ exports.isRef = isRef;
@@ -0,0 +1,8 @@
1
+ import { RefObject } from "@stryke/types/base";
2
+ /**
3
+ * Check if the provided value's type is a ref
4
+ *
5
+ * @param value - The value to type check
6
+ * @returns An indicator specifying if the object provided is of type ref
7
+ */
8
+ export declare const isRef: <TRef = unknown>(value: unknown) => value is RefObject<TRef>;
@@ -0,0 +1 @@
1
+ export const isRef=e=>{try{return e?.current!==void 0}catch{return!1}};
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.isRegExp = void 0;
7
+ var _getObjectTag = require("./get-object-tag.cjs");
8
+ var _isPlainObject = require("./is-plain-object.cjs");
9
+ const isRegExp = e => (0, _isPlainObject.isObjectLike)(e) && (0, _getObjectTag.getObjectTag)(e) === "[object RegExp]";
10
+ exports.isRegExp = isRegExp;
@@ -0,0 +1,16 @@
1
+ /**
2
+ * Checks if `value` is classified as a `isRegExp` object.
3
+ *
4
+ * @example
5
+ * ```typescript
6
+ * isRegExp(new Date)
7
+ * // => true
8
+ *
9
+ * isRegExp('Mon April 23 2012')
10
+ * // => false
11
+ * ```
12
+ *
13
+ * @param value - The value to check.
14
+ * @returns Returns `true` if `obj` is a isRegExp object, else `false`.
15
+ */
16
+ export declare const isRegExp: (value: unknown) => value is RegExp;
@@ -0,0 +1 @@
1
+ import{getObjectTag as o}from"./get-object-tag";import{isObjectLike as t}from"./is-plain-object";export const isRegExp=e=>t(e)&&o(e)==="[object RegExp]";
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.isSelectOption = void 0;
7
+ var _isEmpty = require("./is-empty.cjs");
8
+ const isSelectOption = t => {
9
+ try {
10
+ return !(0, _isEmpty.isEmpty)(t?.name) && "value" in t;
11
+ } catch {
12
+ return !1;
13
+ }
14
+ };
15
+ exports.isSelectOption = isSelectOption;
@@ -0,0 +1,8 @@
1
+ import { SelectOption } from "@stryke/types/form";
2
+ /**
3
+ * Check if the provided value's type is SelectOption
4
+ *
5
+ * @param value - The value to type check
6
+ * @returns An indicator specifying if the object provided is of type SelectOption
7
+ */
8
+ export declare const isSelectOption: (value: unknown) => value is SelectOption;
@@ -0,0 +1 @@
1
+ import{isEmpty as e}from"./is-empty";export const isSelectOption=t=>{try{return!e(t?.name)&&"value"in t}catch{return!1}};
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.isSetObject = void 0;
7
+ var _isNonNullObject = require("./is-non-null-object.cjs");
8
+ const isSetObject = t => {
9
+ try {
10
+ return (0, _isNonNullObject.isNonNullObject)(t) && Object.keys(t).length > 0;
11
+ } catch {
12
+ return !1;
13
+ }
14
+ };
15
+ exports.isSetObject = isSetObject;
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Check if the provided value's type is an object with some fields set
3
+ *
4
+ * @param value - The value to type check
5
+ * @returns An indicator specifying if the value provided is an object with some fields se
6
+ */
7
+ export declare const isSetObject: (value: unknown) => value is NonNullable<object>;
@@ -0,0 +1 @@
1
+ import{isNonNullObject as e}from"./is-non-null-object";export const isSetObject=t=>{try{return e(t)&&Object.keys(t).length>0}catch{return!1}};
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.isSetString = void 0;
7
+ var _isSet = require("./is-set.cjs");
8
+ var _isString = require("./is-string.cjs");
9
+ const isSetString = t => {
10
+ try {
11
+ return (0, _isSet.isSet)(t) && (0, _isString.isString)(t) && t.length > 0;
12
+ } catch {
13
+ return !1;
14
+ }
15
+ };
16
+ exports.isSetString = isSetString;
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Determine if the type is string and is not empty (length greater than zero)
3
+ *
4
+ * @param value - The value to type check
5
+ * @returns An indicator specifying if the value provided is of type `string` and length greater than zero
6
+ */
7
+ export declare const isSetString: (value: unknown) => value is NonNullable<string>;
@@ -0,0 +1 @@
1
+ import{isSet as r}from"./is-set";import{isString as n}from"./is-string";export const isSetString=t=>{try{return r(t)&&n(t)&&t.length>0}catch{return!1}};
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.isSet = void 0;
7
+ var _isEmpty = require("./is-empty.cjs");
8
+ const isSet = n => {
9
+ try {
10
+ return !(0, _isEmpty.isEmpty)(n);
11
+ } catch {
12
+ return !1;
13
+ }
14
+ };
15
+ exports.isSet = isSet;
@@ -0,0 +1,7 @@
1
+ /**
2
+ * The inverse of the `isEmpty` function
3
+ *
4
+ * @param value - The value to type check
5
+ * @returns An indicator specifying if the value provided is **NOT** of type `null` or `undefined`
6
+ */
7
+ export declare const isSet: (value: unknown) => value is NonNullable<unknown>;
@@ -0,0 +1 @@
1
+ import{isEmpty as t}from"./is-empty";export const isSet=n=>{try{return!t(n)}catch{return!1}};
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.isString = void 0;
7
+ const isString = t => {
8
+ try {
9
+ return typeof t == "string";
10
+ } catch {
11
+ return !1;
12
+ }
13
+ };
14
+ exports.isString = isString;
@@ -0,0 +1 @@
1
+ export declare const isString: (value: unknown) => value is string;
@@ -0,0 +1 @@
1
+ export const isString=t=>{try{return typeof t=="string"}catch{return!1}};
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.isSymbol = void 0;
7
+ const isSymbol = o => {
8
+ try {
9
+ return o instanceof Symbol || typeof o == "symbol" || !!o && o.constructor === Symbol;
10
+ } catch {
11
+ return !1;
12
+ }
13
+ };
14
+ exports.isSymbol = isSymbol;
@@ -0,0 +1 @@
1
+ export declare const isSymbol: (value: unknown) => value is symbol;
@@ -0,0 +1 @@
1
+ export const isSymbol=o=>{try{return o instanceof Symbol||typeof o=="symbol"||!!o&&o.constructor===Symbol}catch{return!1}};
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.isTypedArray = isTypedArray;
7
+ function isTypedArray(r) {
8
+ return r instanceof Uint8Array || r instanceof Uint8ClampedArray || r instanceof Uint16Array || r instanceof Uint32Array || r instanceof BigUint64Array || r instanceof Int8Array || r instanceof Int16Array || r instanceof Int32Array || r instanceof BigInt64Array || r instanceof Float32Array || r instanceof Float64Array;
9
+ }
@@ -0,0 +1 @@
1
+ export declare function isTypedArray(obj: any): obj is Uint8Array | Uint8ClampedArray | Uint16Array | Uint32Array | BigUint64Array | Int8Array | Int16Array | Int32Array | BigInt64Array | Float32Array | Float64Array;
@@ -0,0 +1 @@
1
+ export function isTypedArray(r){return r instanceof Uint8Array||r instanceof Uint8ClampedArray||r instanceof Uint16Array||r instanceof Uint32Array||r instanceof BigUint64Array||r instanceof Int8Array||r instanceof Int16Array||r instanceof Int32Array||r instanceof BigInt64Array||r instanceof Float32Array||r instanceof Float64Array}
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.isTyped = void 0;
7
+ var _isObject = require("./is-object.cjs");
8
+ var _isSet = require("./is-set.cjs");
9
+ const isTyped = r => {
10
+ try {
11
+ return (0, _isSet.isSet)(r) && (0, _isObject.isObject)(r) && "__typename" in r;
12
+ } catch {
13
+ return !1;
14
+ }
15
+ };
16
+ exports.isTyped = isTyped;
@@ -0,0 +1,8 @@
1
+ import { ITyped } from "@stryke/types/base";
2
+ /**
3
+ * Check if the provided value has a `__typename` property
4
+ *
5
+ * @param value - The value to type check
6
+ * @returns An indicator specifying if the value provided has a `__typename` property
7
+ */
8
+ export declare const isTyped: (value: unknown) => value is ITyped;
@@ -0,0 +1 @@
1
+ import{isObject as t}from"./is-object";import{isSet as e}from"./is-set";export const isTyped=r=>{try{return e(r)&&t(r)&&"__typename"in r}catch{return!1}};
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.isUndefined = void 0;
7
+ const isUndefined = n => n === void 0;
8
+ exports.isUndefined = isUndefined;
@@ -0,0 +1 @@
1
+ export declare const isUndefined: (value: unknown) => value is undefined;
@@ -0,0 +1 @@
1
+ export const isUndefined=n=>n===void 0;
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.propertyUnsafe = exports.propertyExists = void 0;
7
+ var _isObject = require("./is-object.cjs");
8
+ const propertyExists = (r, t) => {
9
+ try {
10
+ return (0, _isObject.isObject)(r) && t in r;
11
+ } catch {
12
+ return !1;
13
+ }
14
+ },
15
+ propertyUnsafe = (r, t) => propertyExists(r, t) && !(Object.hasOwnProperty.call(r, t) && Object.propertyIsEnumerable.call(r, t));
16
+ exports.propertyUnsafe = propertyUnsafe;
17
+ exports.propertyExists = propertyExists;
@@ -0,0 +1,16 @@
1
+ /**
2
+ * Check if the provided object has the provided property
3
+ *
4
+ * @param object - The object to check
5
+ * @param propertyKey - The property to check
6
+ * @returns An indicator specifying if the object has the provided property
7
+ */
8
+ export declare const propertyExists: (object: any, propertyKey: PropertyKey) => boolean;
9
+ /**
10
+ * Check if the provided object has the provided property and if it's safe to merge
11
+ *
12
+ * @param object - The object to check
13
+ * @param propertyKey - The property to check
14
+ * @returns An indicator specifying if the object has the provided property and if it's safe to merge
15
+ */
16
+ export declare const propertyUnsafe: (object: any, propertyKey: PropertyKey) => boolean;
@@ -0,0 +1 @@
1
+ import{isObject as e}from"./is-object";export const propertyExists=(r,t)=>{try{return e(r)&&t in r}catch{return!1}},propertyUnsafe=(r,t)=>propertyExists(r,t)&&!(Object.hasOwnProperty.call(r,t)&&Object.propertyIsEnumerable.call(r,t));
@@ -0,0 +1,38 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.typeDetect = typeDetect;
7
+ var _isBuffer = require("./is-buffer.cjs");
8
+ const a = (t => (typeof globalThis == "object" || Object.defineProperty(t, "typeDetectGlobalObject", {
9
+ get() {
10
+ return this;
11
+ },
12
+ configurable: !0
13
+ }), globalThis))(Object.prototype);
14
+ function typeDetect(t) {
15
+ if ((0, _isBuffer.isBuffer)(t)) return "Buffer";
16
+ const r = typeof t;
17
+ if (r !== "object") return r;
18
+ if (t === null) return "null";
19
+ if (t === a) return "global";
20
+ if (Array.isArray(t) && (Symbol.toStringTag === void 0 || !(Symbol.toStringTag in t))) return "Array";
21
+ if (typeof globalThis == "object" && globalThis !== null) {
22
+ if (typeof globalThis.location == "object" && t === globalThis.location) return "Location";
23
+ if (typeof globalThis.document == "object" && t === globalThis.document) return "Document";
24
+ if (typeof globalThis.navigator == "object") {
25
+ if (typeof globalThis.navigator.mimeTypes == "object" && t === globalThis.navigator.mimeTypes) return "MimeTypeArray";
26
+ if (typeof globalThis.navigator.plugins == "object" && t === globalThis.navigator.plugins) return "PluginArray";
27
+ }
28
+ if ((typeof globalThis.HTMLElement == "function" || typeof globalThis.HTMLElement == "object") && t instanceof globalThis.HTMLElement) {
29
+ if (t.tagName === "BLOCKQUOTE") return "HTMLQuoteElement";
30
+ if (t.tagName === "TD") return "HTMLTableDataCellElement";
31
+ if (t.tagName === "TH") return "HTMLTableHeaderCellElement";
32
+ }
33
+ }
34
+ const o = Symbol.toStringTag !== void 0 && t[Symbol.toStringTag];
35
+ if (typeof o == "string") return o;
36
+ const e = Object.getPrototypeOf(t);
37
+ return e === RegExp.prototype ? "RegExp" : e === Date.prototype ? "Date" : typeof Promise < "u" && e === Promise.prototype ? "Promise" : typeof Set < "u" && e === Set.prototype ? "Set" : typeof Map < "u" && e === Map.prototype ? "Map" : typeof WeakSet < "u" && e === WeakSet.prototype ? "WeakSet" : typeof WeakMap < "u" && e === WeakMap.prototype ? "WeakMap" : typeof DataView < "u" && e === DataView.prototype ? "DataView" : typeof Map < "u" && e === Object.getPrototypeOf(new Map().entries()) ? "Map Iterator" : typeof Set < "u" && e === Object.getPrototypeOf(new Set().entries()) ? "Set Iterator" : typeof Array.prototype[Symbol.iterator] == "function" && e === Object.getPrototypeOf([][Symbol.iterator]()) ? "Array Iterator" : Symbol.iterator !== void 0 && typeof String.prototype[Symbol.iterator] == "function" && Object.getPrototypeOf(""[Symbol.iterator]()) && e === Object.getPrototypeOf(""[Symbol.iterator]()) ? "String Iterator" : e === null ? "Object" : Object.prototype.toString.call(t).slice(8, -1);
38
+ }
@@ -0,0 +1 @@
1
+ export declare function typeDetect(obj: unknown): string;
@@ -0,0 +1 @@
1
+ import{isBuffer as n}from"./is-buffer";const a=(t=>(typeof globalThis=="object"||Object.defineProperty(t,"typeDetectGlobalObject",{get(){return this},configurable:!0}),globalThis))(Object.prototype);export function typeDetect(t){if(n(t))return"Buffer";const r=typeof t;if(r!=="object")return r;if(t===null)return"null";if(t===a)return"global";if(Array.isArray(t)&&(Symbol.toStringTag===void 0||!(Symbol.toStringTag in t)))return"Array";if(typeof globalThis=="object"&&globalThis!==null){if(typeof globalThis.location=="object"&&t===globalThis.location)return"Location";if(typeof globalThis.document=="object"&&t===globalThis.document)return"Document";if(typeof globalThis.navigator=="object"){if(typeof globalThis.navigator.mimeTypes=="object"&&t===globalThis.navigator.mimeTypes)return"MimeTypeArray";if(typeof globalThis.navigator.plugins=="object"&&t===globalThis.navigator.plugins)return"PluginArray"}if((typeof globalThis.HTMLElement=="function"||typeof globalThis.HTMLElement=="object")&&t instanceof globalThis.HTMLElement){if(t.tagName==="BLOCKQUOTE")return"HTMLQuoteElement";if(t.tagName==="TD")return"HTMLTableDataCellElement";if(t.tagName==="TH")return"HTMLTableHeaderCellElement"}}const o=Symbol.toStringTag!==void 0&&t[Symbol.toStringTag];if(typeof o=="string")return o;const e=Object.getPrototypeOf(t);return e===RegExp.prototype?"RegExp":e===Date.prototype?"Date":typeof Promise<"u"&&e===Promise.prototype?"Promise":typeof Set<"u"&&e===Set.prototype?"Set":typeof Map<"u"&&e===Map.prototype?"Map":typeof WeakSet<"u"&&e===WeakSet.prototype?"WeakSet":typeof WeakMap<"u"&&e===WeakMap.prototype?"WeakMap":typeof DataView<"u"&&e===DataView.prototype?"DataView":typeof Map<"u"&&e===Object.getPrototypeOf(new Map().entries())?"Map Iterator":typeof Set<"u"&&e===Object.getPrototypeOf(new Set().entries())?"Set Iterator":typeof Array.prototype[Symbol.iterator]=="function"&&e===Object.getPrototypeOf([][Symbol.iterator]())?"Array Iterator":Symbol.iterator!==void 0&&typeof String.prototype[Symbol.iterator]=="function"&&Object.getPrototypeOf(""[Symbol.iterator]())&&e===Object.getPrototypeOf(""[Symbol.iterator]())?"String Iterator":e===null?"Object":Object.prototype.toString.call(t).slice(8,-1)}