@mudbean/is 2.0.2 → 2.0.4

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 (42) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/cjs/error.js +211 -1
  3. package/cjs/index.js +76 -1
  4. package/cjs/intl.js +152 -1
  5. package/cjs/isArray.js +340 -1
  6. package/cjs/isBoolean.js +71 -1
  7. package/cjs/isFunction.js +120 -1
  8. package/cjs/isNull.js +49 -1
  9. package/cjs/isNumber.js +148 -1
  10. package/cjs/isObject.js +200 -1
  11. package/cjs/isString.js +121 -1
  12. package/cjs/isSymbol.js +36 -1
  13. package/cjs/isType.js +16 -1
  14. package/cjs/typeOf.js +72 -1
  15. package/es/error.js +202 -1
  16. package/es/index.js +12 -1
  17. package/es/intl.js +145 -1
  18. package/es/isArray.js +323 -1
  19. package/es/isBoolean.js +67 -1
  20. package/es/isFunction.js +114 -1
  21. package/es/isNull.js +46 -1
  22. package/es/isNumber.js +141 -1
  23. package/es/isObject.js +193 -1
  24. package/es/isString.js +116 -1
  25. package/es/isSymbol.js +34 -1
  26. package/es/isType.js +14 -1
  27. package/es/typeOf.js +70 -1
  28. package/package.json +107 -62
  29. /package/es/{types/error.d.ts → error.d.ts} +0 -0
  30. /package/es/{types/index.d.ts → index.d.ts} +0 -0
  31. /package/es/{types/intl.d.ts → intl.d.ts} +0 -0
  32. /package/es/{types/isArray.d.ts → isArray.d.ts} +0 -0
  33. /package/es/{types/isBoolean.d.ts → isBoolean.d.ts} +0 -0
  34. /package/es/{types/isFunction.d.ts → isFunction.d.ts} +0 -0
  35. /package/es/{types/isNull.d.ts → isNull.d.ts} +0 -0
  36. /package/es/{types/isNumber.d.ts → isNumber.d.ts} +0 -0
  37. /package/es/{types/isObject.d.ts → isObject.d.ts} +0 -0
  38. /package/es/{types/isString.d.ts → isString.d.ts} +0 -0
  39. /package/es/{types/isSymbol.d.ts → isSymbol.d.ts} +0 -0
  40. /package/es/{types/isType.d.ts → isType.d.ts} +0 -0
  41. /package/es/{types/typeOf.d.ts → typeOf.d.ts} +0 -0
  42. /package/es/{types/types.d.ts → types.d.ts} +0 -0
package/es/error.js CHANGED
@@ -1 +1,202 @@
1
- import{typeOf as r}from"./typeOf.js";function e(e){return"error"===r(e)}function n(e){return"evalerror"===r(e)}function t(e){return"rangeerror"===r(e)}function o(e){return"referenceerror"===r(e)}function u(e){return"syntaxerror"===r(e)}function f(e){return"typeerror"===r(e)}function i(e){return"urierror"===r(e)}function c(e){return"aggregateerror"===r(e)}export{c as isAggregateError,e as isError,n as isEvalError,t as isRangeError,o as isReferenceError,u as isSyntaxError,f as isTypeError,i as isURIError};
1
+ import { typeOf } from './typeOf.js';
2
+
3
+ /**
4
+ * 检测 Javascript 数据类型工具之: error
5
+ */
6
+ /**
7
+ * # 检测 `input` 是否是 `Error` 类型
8
+ *
9
+ * @param input - 待检测的数据,任意类型
10
+ * @returns 返回 `true` 则说明该数据 `input` 类型为 `Error` ,且在 Typescript 中进行类型收缩
11
+ * @example
12
+ *
13
+ * ```ts
14
+ * import { isError } from '@mudbean/is';
15
+ *
16
+ * console.log(isError(new Error('test'))); // true
17
+ *
18
+ * // false (类型不符)
19
+ * console.log(isError(new EvalError('test')));
20
+ * // false (类型不符)
21
+ * console.log(isError(new RangeError('test')));
22
+ * // false (类型不符)
23
+ * console.log(isError(new ReferenceError('test')));
24
+ *
25
+ * // false (类型不符)
26
+ * console.log(isError({ message: 'test' }));
27
+ * ```
28
+ * @since 0.1.4
29
+ */
30
+ function isError(input) {
31
+ return typeOf(input) === 'error';
32
+ }
33
+ /**
34
+ * # 检测 `input` 是否是 `EvalError` 类型
35
+ *
36
+ * @param input - 待检测的数据,任意类型
37
+ * @returns 返回 `true` 则说明该数据 `input` 类型为 `EvalError` ,且在 Typescript 中进行类型收缩
38
+ * @example
39
+ *
40
+ * ```ts
41
+ * import { isEvalError } from '@mudbean/is';
42
+ *
43
+ * console.log(isEvalError(new EvalError('test'))); // true
44
+ *
45
+ * // false (类型非 EvalError)
46
+ * console.log(isEvalError(new Error('test')));
47
+ * // false (类型非 EvalError)
48
+ * console.log(isEvalError(new TypeError('test')));
49
+ * // false (类型非 EvalError)
50
+ * console.log(isEvalError(new RangeError('test')));
51
+ *
52
+ * // false (类型非 EvalError)
53
+ * console.log(isEvalError({ message: 'test' }));
54
+ * ```
55
+ */
56
+ function isEvalError(input) {
57
+ return typeOf(input) === 'evalerror';
58
+ }
59
+ /**
60
+ * # 检测 `input 是否是 `RangeError` 类型
61
+ *
62
+ * @param input - 待检测的数据,任意类型
63
+ * @returns 返回 `true` 则说明该数据 `input` 类型为 `RangeError` ,且在 Typescript 中进行类型收缩
64
+ * @example
65
+ *
66
+ * ```ts
67
+ * import { isRangeError } from '@mudbean/is';
68
+ *
69
+ * console.log(isRangeError(new RangeError('test'))); // true
70
+ *
71
+ * // false (类型非 RangeError
72
+ * console.log(isRangeError(new Error('test')));
73
+ * // false (类型非 RangeError)
74
+ * console.log(isRangeError(new TypeError('test')));
75
+ * // false (类型非 RangeError)
76
+ * console.log(isRangeError(new SyntaxError('test')));
77
+ *
78
+ * // false (类型非 RangeError)
79
+ * console.log(isRangeError('test'));
80
+ * ```
81
+ */
82
+ function isRangeError(input) {
83
+ return typeOf(input) === 'rangeerror';
84
+ }
85
+ /**
86
+ * # 检测 `input` 是否是 `ReferenceError` 类型
87
+ *
88
+ * @param input - 待检测的数据,任意类型
89
+ * @returns 返回 `true` 则说明该数据 `input` 类型为 `ReferenceError` ,且在 Typescript 中进行类型收缩
90
+ * @example
91
+ *
92
+ * ```ts
93
+ * import { isReferenceError } from '@mudbean/is';
94
+ *
95
+ * console.log(isReferenceError(new ReferenceError('test'))); // true
96
+ *
97
+ * // false (类型非 ReferenceError)
98
+ * console.log(isReferenceError(new Error('test')));
99
+ * // false (类型非 ReferenceError)
100
+ * console.log(isReferenceError(new TypeError('test')));
101
+ * // false (类型非 ReferenceError)
102
+ * console.log(isReferenceError(new SyntaxError('test')));
103
+ *
104
+ * // false (类型非 ReferenceError)
105
+ * console.log(isReferenceError('test');
106
+ * ```
107
+ */
108
+ function isReferenceError(input) {
109
+ return typeOf(input) === 'referenceerror';
110
+ }
111
+ /**
112
+ * # 检测 `input` 是否是 `SyntaxError` 类型
113
+ *
114
+ * @param input - 待检测的数据,任意类型
115
+ * @returns 返回 `true` 则说明该数据 `input` 类型为 `SyntaxError` ,且在 Typescript 中进行类型收缩
116
+ * @example
117
+ *
118
+ * ```ts
119
+ * import { isSyntaxError } from '@mudbean/is';
120
+ *
121
+ * console.log(isSyntaxError(new SyntaxError('test'))); // true
122
+ *
123
+ * // false (类型非 SyntaxError)
124
+ * console.log(isSyntaxError(new Error('test')));
125
+ * // false (类型非 SyntaxError)
126
+ * console.log(isSyntaxError(new TypeError('test')));
127
+ * // false (类型非 SyntaxError)
128
+ * console.log(isSyntaxError(new ReferenceError('test')));
129
+ *
130
+ * // false (类型非 SyntaxError)
131
+ * console.log(isSyntaxError('test'));
132
+ * ```
133
+ */
134
+ function isSyntaxError(input) {
135
+ return typeOf(input) === 'syntaxerror';
136
+ }
137
+ /**
138
+ * # 检测 `input` 是否是 `TypeError` 类型
139
+ *
140
+ * @param input - 待检测的数据,任意类型
141
+ * @returns 返回 `true` 则说明该数据 `input` 类型为 `TypeError` ,且在 Typescript 中进行类型收缩
142
+ * @example
143
+ *
144
+ * ```ts
145
+ * import { isTypeError } from '@mudbean/is';
146
+ *
147
+ * console.log(isTypeError(new TypeError('test'))); // true
148
+ *
149
+ * // false (类型非 TypeError)
150
+ * console.log(isTypeError(new Error('test')));
151
+ * // false (类型非 TypeError)
152
+ * console.log(isTypeError(new SyntaxError('test')));
153
+ * // false (类型非 TypeError)
154
+ * console.log(isTypeError(new ReferenceError('test')));
155
+ * // false (类型非 TypeError)
156
+ * console.log(isTypeError(new EvalError('test')));
157
+ *
158
+ * // false (类型非 TypeError)
159
+ * console.log(isTypeError('test');
160
+ * ```
161
+ */
162
+ function isTypeError(input) {
163
+ return typeOf(input) === 'typeerror';
164
+ }
165
+ /**
166
+ * # 检测 `input` 是否是 `URIError` 类型
167
+ *
168
+ * @param input - 待检测的数据,任意类型
169
+ * @returns 返回 `true` 则说明该数据 `input` 类型为 `URIError` ,且在 Typescript 中进行类型收缩
170
+ * @example
171
+ *
172
+ * ```ts
173
+ * import { isURIError } from '@mudbean/is';
174
+ *
175
+ * console.log(isURIError(new URIError('test'))); // true
176
+ *
177
+ * console.log(isURIError(new Error('test'))); // false
178
+ * ```
179
+ */
180
+ function isURIError(input) {
181
+ return typeOf(input) === 'urierror';
182
+ }
183
+ /**
184
+ * # 检测 `input` 是否是 `AggregateError` 类型
185
+ *
186
+ * @param input - 待检测的数据,任意类型
187
+ * @returns 返回 `true` 则说明该数据 `input` 类型为 `AggregateError` ,且在 Typescript 中进行类型收缩
188
+ * @example
189
+ *
190
+ * ```ts
191
+ * import { isAggregateError } from '@mudbean/is';
192
+ *
193
+ * console.log(isAggregateError(new AggregateError([]))); // true
194
+ *
195
+ * console.log(isAggregateError(new Error('test'))); // false
196
+ * ```
197
+ */
198
+ function isAggregateError(input) {
199
+ return typeOf(input) === 'aggregateerror';
200
+ }
201
+
202
+ export { isAggregateError, isError, isEvalError, isRangeError, isReferenceError, isSyntaxError, isTypeError, isURIError };
package/es/index.js CHANGED
@@ -1 +1,12 @@
1
- export{typeOf}from"./typeOf.js";export{isBusinessEmptyString,isEmptyString,isRegExp,isString}from"./isString.js";export{isBigInt,isNaN,isNegativeInteger,isNumber,isPositiveInteger,isZero}from"./isNumber.js";export{isBoolean,isFalse,isTrue}from"./isBoolean.js";export{isNull,isUndefined}from"./isNull.js";export{isAsyncFunction,isFunction,isGenerator,isGeneratorFunction,isPromise}from"./isFunction.js";export{isArray,isArrayBuffer,isBigInt64Array,isBigUint64Array,isEmptyArray,isFloat32Array,isFloat64Array,isInt16Array,isInt8Array,isSet,isSharedArrayBuffer,isUint16Array,isUint32Array,isUint8Array,isUint8ClampedArray,isWeakSet}from"./isArray.js";export{isDataView,isDate,isEmptyObject,isMap,isPlainObject,isWeakMap}from"./isObject.js";export{isSymbol}from"./isSymbol.js";export{isIntlCollator,isIntlDateTimeFormat,isIntlDisplayNames,isIntlListFormat,isIntlLocale,isIntlNumberFormat}from"./intl.js";export{isAggregateError,isError,isEvalError,isRangeError,isReferenceError,isSyntaxError,isTypeError,isURIError}from"./error.js";export{isType}from"./isType.js";
1
+ export { typeOf } from './typeOf.js';
2
+ export { isBusinessEmptyString, isEmptyString, isRegExp, isString } from './isString.js';
3
+ export { isBigInt, isNaN, isNegativeInteger, isNumber, isPositiveInteger, isZero } from './isNumber.js';
4
+ export { isBoolean, isFalse, isTrue } from './isBoolean.js';
5
+ export { isNull, isUndefined } from './isNull.js';
6
+ export { isAsyncFunction, isFunction, isGenerator, isGeneratorFunction, isPromise } from './isFunction.js';
7
+ export { isArray, isArrayBuffer, isBigInt64Array, isBigUint64Array, isEmptyArray, isFloat32Array, isFloat64Array, isInt16Array, isInt8Array, isSet, isSharedArrayBuffer, isUint16Array, isUint32Array, isUint8Array, isUint8ClampedArray, isWeakSet } from './isArray.js';
8
+ export { isDataView, isDate, isEmptyObject, isMap, isPlainObject, isWeakMap } from './isObject.js';
9
+ export { isSymbol } from './isSymbol.js';
10
+ export { isIntlCollator, isIntlDateTimeFormat, isIntlDisplayNames, isIntlListFormat, isIntlLocale, isIntlNumberFormat } from './intl.js';
11
+ export { isAggregateError, isError, isEvalError, isRangeError, isReferenceError, isSyntaxError, isTypeError, isURIError } from './error.js';
12
+ export { isType } from './isType.js';
package/es/intl.js CHANGED
@@ -1 +1,145 @@
1
- import{typeOf as t}from"./typeOf.js";function n(n){return"intl.collator"===t(n)}function r(n){return"intl.datetimeformat"===t(n)}function i(n){return"intl.displaynames"===t(n)}function o(n){return"intl.listformat"===t(n)}function e(n){return"intl.locale"===t(n)}function u(n){return"intl.numberformat"===t(n)}export{n as isIntlCollator,r as isIntlDateTimeFormat,i as isIntlDisplayNames,o as isIntlListFormat,e as isIntlLocale,u as isIntlNumberFormat};
1
+ import { typeOf } from './typeOf.js';
2
+
3
+ /**
4
+ * 检测 Javascript 数据类型工具之: Intl
5
+ * @author Mr.MudBean <Mr.MudBean@outlook.com>
6
+ */
7
+ /**
8
+ * # 检测 `input` 是否是 `Intl.Collator` 类型
9
+ *
10
+ * @param input - 待检测的数据,任意类型
11
+ * @returns 返回 `true` 则说明该数据 `input` 类型为 `Intl.Collator` ,且在 Typescript 中进行类型收缩
12
+ * @example
13
+ *
14
+ * ```ts
15
+ * import { isIntlCollator } from '@mudbean/is';
16
+ *
17
+ * console.log(isIntlCollator(new Intl.Collator())); // true
18
+ *
19
+ * console.log(isIntlCollator(new Intl.DateTimeFormat())); // false
20
+ * ```
21
+ */
22
+ function isIntlCollator(input) {
23
+ return typeOf(input) === 'intl.collator';
24
+ }
25
+ /**
26
+ * # 检测 `input` 是否是 `Intl.DateTimeFormat` 类型
27
+ *
28
+ * @param input - 待检测的数据,任意类型
29
+ * @returns 返回 `true` 则说明该数据 `input` 类型为 `Intl.DateTimeFormat` ,且在 Typescript 中进行类型收缩
30
+ *
31
+ * @example
32
+ *
33
+ * ```ts
34
+ * import { isIntlDateTimeFormat } from '@mudbean/is';
35
+ *
36
+ * console.log(isIntlDateTimeFormat(new Intl.DateTimeFormat())); // true
37
+ *
38
+ * console.log(isIntlDateTimeFormat('hello')); // false
39
+ * console.log(isIntlDateTimeFormat(1)); // false
40
+ * console.log(isIntlDateTimeFormat(true)); // false
41
+ * ```
42
+ */
43
+ function isIntlDateTimeFormat(input) {
44
+ return typeOf(input) === 'intl.datetimeformat';
45
+ }
46
+ /**
47
+ * # 检测 `input` 是否是 `Intl.DisplayNames` 类型
48
+ *
49
+ * @param input - 待检测的数据,任意类型
50
+ * @returns 返回 `true` 则说明该数据 `input` 类型为 `Intl.DisplayNames` ,且在 Typescript 中进行类型收缩
51
+ * @example
52
+ *
53
+ * ```ts
54
+ * import { isIntlDisplayNames } from '@mudbean/is';
55
+ *
56
+ * console.log(isIntlDisplayNames(new Intl.DisplayNames())); // true
57
+ *
58
+ * console.log(isIntlDisplayNames(new Intl.Locale())); // false
59
+ * ```
60
+ */
61
+ function isIntlDisplayNames(input) {
62
+ return typeOf(input) === 'intl.displaynames';
63
+ }
64
+ /**
65
+ * #检测 `input` 是否是 `Intl.DurationFormat` 类型
66
+ *
67
+ * @param input - 待检测的数据,任意类型
68
+ * @returns 返回 `true` 则说明该数据 `input` 类型为 `Intl.DurationFormat` ,且在 Typescript 中进行类型收缩
69
+ * @example
70
+ *
71
+ * ```ts
72
+ * import { isIntlDurationFormat } from '@mudbean/is';
73
+ *
74
+ * ```
75
+ *
76
+ */
77
+ // export function isIntlDurationFormat(
78
+ // input: any,
79
+ // ): input is Intl.DurationFormat {
80
+ // return typeOf(input) === 'intl.durationformat';
81
+ // }
82
+ /**
83
+ * # 检测 `input` 是否是 `Intl.ListFormat` 类型
84
+ * @param input - 待检测的数据,任意类型
85
+ * @returns 返回 `true` 则说明该数据 `input` 类型为 `Intl.ListFormat` ,且在 Typescript 中进行类型收缩
86
+ * @example
87
+ *
88
+ * ```ts
89
+ * import { isIntlListFormat } from '@mudbean/is';
90
+ *
91
+ * console.log(isIntlListFormat(new Intl.ListFormat())); // true
92
+ *
93
+ * console.log(isIntlListFormat(new Intl.DateTimeFormat())); // false
94
+ * console.log(isIntlListFormat(1)); // false
95
+ * console.log(isIntlListFormat('1')); // false
96
+ * console.log(isIntlListFormat(null)); // false
97
+ * ```
98
+ */
99
+ function isIntlListFormat(input) {
100
+ return typeOf(input) === 'intl.listformat';
101
+ }
102
+ /**
103
+ * # 检测 `input` 是否是 `Intl.Locale` 类型
104
+ *
105
+ * @param input - 待检测的数据,任意类型
106
+ * @returns 返回 `true` 则说明该数据 `input` 类型为 `Intl.Locale` ,且在 Typescript 中进行类型收缩
107
+ *
108
+ * @example
109
+ *
110
+ * ```ts
111
+ * import { isIntlLocale } from '@mudbean/is';
112
+ *
113
+ * console.log(isIntlLocale(new Intl.Locale())); // true
114
+ *
115
+ * console.log(isIntlLocale('en')); // false
116
+ * console.log(isIntlLocale(1)); // false
117
+ * ```
118
+ */
119
+ function isIntlLocale(input) {
120
+ return typeOf(input) === 'intl.locale';
121
+ }
122
+ /**
123
+ * # 检测 `input` 是否是 `Intl.NumberFormat` 类型
124
+ *
125
+ * @param input - 待检测的数据,任意类型
126
+ * @returns 返回 `true` 则说明该数据 `input` 类型为 `Intl.NumberFormat` ,且在 Typescript 中进行类型收缩
127
+ *
128
+ * @example
129
+ *
130
+ * ```ts
131
+ * import { isIntlNumberFormat } from '@mudbean/is';
132
+ *
133
+ * console.log(isIntlNumberFormat(new Intl.NumberFormat())); // true
134
+ *
135
+ * console.log(isIntlNumberFormat(123)); // false
136
+ * console.log(isIntlNumberFormat('123')); // false
137
+ * console.log(isIntlNumberFormat(new Date())); // false
138
+ * console.log(isIntlNumberFormat(new Date(0))); // false
139
+ * ```
140
+ */
141
+ function isIntlNumberFormat(input) {
142
+ return typeOf(input) === 'intl.numberformat';
143
+ }
144
+
145
+ export { isIntlCollator, isIntlDateTimeFormat, isIntlDisplayNames, isIntlListFormat, isIntlLocale, isIntlNumberFormat };
package/es/isArray.js CHANGED
@@ -1 +1,323 @@
1
- import{typeOf as r}from"./typeOf.js";function n(r){return Array.isArray(r)}function t(r){if(n(r))return 0===r.length;throw new TypeError("参数必须为数组")}function u(n){return"set"===r(n)}function a(n){return"weakset"===r(n)}function i(n){return"bigint64array"===r(n)}function e(n){return"biguint64array"===r(n)}function f(n){return"arraybuffer"===r(n)}function o(n){return"int8array"===r(n)}function c(n){return"uint8array"===r(n)}function y(n){return"int16array"===r(n)}function p(n){return"uint16array"===r(n)}function s(n){return"uint32array"===r(n)}function b(n){return"float32array"===r(n)}function l(n){return"float64array"===r(n)}function g(n){return"sharedarraybuffer"===r(n)}function h(n){return"uint8clampedarray"===r(n)}export{n as isArray,f as isArrayBuffer,i as isBigInt64Array,e as isBigUint64Array,t as isEmptyArray,b as isFloat32Array,l as isFloat64Array,y as isInt16Array,o as isInt8Array,u as isSet,g as isSharedArrayBuffer,p as isUint16Array,s as isUint32Array,c as isUint8Array,h as isUint8ClampedArray,a as isWeakSet};
1
+ import { typeOf } from './typeOf.js';
2
+
3
+ /**
4
+ * 检测 Javascript 数据类型工具之: array
5
+ */
6
+ /**
7
+ * # 检测 `input` 是否是 `Array` 类型
8
+ *
9
+ * @param input - 待检测的数据,任意类型
10
+ * @returns 返回 `true` 则说明该数据 `input` 类型为 `ReferenceError` ,且在 Typescript 中进行类型收缩
11
+ * @example
12
+ *
13
+ * ```ts
14
+ * import { isArray } from '@mudbean/is';
15
+ *
16
+ * console.log(isArray([1,2,3])) // true
17
+ * console.log(isArray({})) // false
18
+ * console.log(isArray(new Set())) // false
19
+ * ```
20
+ */
21
+ function isArray(input) {
22
+ return Array.isArray(input);
23
+ }
24
+ /**
25
+ * # 检测 `input` 是否是空数组
26
+ *
27
+ * @param input - 待检测的数据,任意数组
28
+ * @returns 返回 `true` 则说明该数据 `input` 为长度为 0 的空数组 ,且在 Typescript 中进行类型收缩
29
+ * @example
30
+ *
31
+ * ```ts
32
+ * import { isEmptyArray } from '@mudbean/is';
33
+ *
34
+ * console.log(isEmptyArray([])) // true
35
+ *
36
+ * console.log(isEmptyArray([1,2,3])) // false
37
+ * console.log(isEmptyArray({})) // TypeError
38
+ * console.log(isEmptyArray(new Set())) // false
39
+ * ```
40
+ */
41
+ function isEmptyArray(input) {
42
+ if (isArray(input)) {
43
+ return input.length === 0;
44
+ }
45
+ throw new TypeError('参数必须为数组');
46
+ }
47
+ /**
48
+ * # 检测 `input` 是否是 `Set` 类型
49
+ *
50
+ * @param input - 待检测的数据,任意类型
51
+ * @returns 返回 `true` 则说明该数据 `input` 类型为 `ReferenceError` ,且在 Typescript 中进行类型收缩
52
+ * @example
53
+ *
54
+ * ```ts
55
+ * import { isSet } from '@mudbean/is';
56
+ *
57
+ * console.log(isSet(new Set())) // true
58
+ * console.log(isSet({})) // false
59
+ * console.log(isSet([])) // false
60
+ * ```
61
+ */
62
+ function isSet(input) {
63
+ return typeOf(input) === 'set';
64
+ }
65
+ /**
66
+ * # 检测 `input` 是否是 `WeakSet` 类型
67
+ *
68
+ * @param input - 待检测的数据,任意类型
69
+ * @returns 返回 `true` 则说明该数据 `input` 类型为 `WeakSet` ,且在 Typescript 中进行类型收缩
70
+ * @example
71
+ *
72
+ * ```ts
73
+ * import { isWeakSet } from '@mudbean/is';
74
+ *
75
+ * console.log(isWeakSet(new WeakSet())) // true
76
+ *
77
+ * console.log(isWeakSet({})) // false
78
+ * console.log(isWeakSet([])) // false
79
+ * console.log(isWeakSet(1)) // false
80
+ * ```
81
+ */
82
+ function isWeakSet(input) {
83
+ return typeOf(input) === 'weakset';
84
+ }
85
+ /**
86
+ * # 检测 `input` 是否是 `Bigint64Array` 类型
87
+ *
88
+ * @param input - 待检测的数据,任意类型
89
+ * @returns 返回 `true` 则说明该数据 `input` 类型为 `BigInt64Array` ,且在 Typescript 中进行类型收缩
90
+ * @example
91
+ *
92
+ * ```ts
93
+ * import { isBigInt64Array } from '@mudbean/is';
94
+ *
95
+ * console.log(isBigInt64Array(new BigInt64Array())) // true
96
+ *
97
+ * console.log(isBigInt64Array({})) // false
98
+ * console.log(isBigInt64Array([])) // false
99
+ *
100
+ * ```
101
+ */
102
+ function isBigInt64Array(input) {
103
+ return typeOf(input) === 'bigint64array';
104
+ }
105
+ /**
106
+ * # 检测 `input` 是否是 `BigUint64Array` 类型
107
+ *
108
+ * @param input - 待检测的数据,任意类型
109
+ * @returns 返回 `true` 则说明该数据 `input` 类型为 `BigUint64Array` ,且在 Typescript 中进行类型收缩
110
+ * @example
111
+ *
112
+ * ```ts
113
+ * import { isBigUint64Array } from '@mudbean/is';
114
+ *
115
+ * console.log(isBigUint64Array(new BigUint64Array())) // true
116
+ *
117
+ * console.log(isBigUint64Array({})) // false
118
+ * console.log(isBigUint64Array([])) // false
119
+ * console.log(isBigUint64Array(1)) // false
120
+ * ```
121
+ */
122
+ function isBigUint64Array(input) {
123
+ return typeOf(input) === 'biguint64array';
124
+ }
125
+ /**
126
+ * # 检测 `input` 是否是 `ArrayBuffer` 类型
127
+ *
128
+ * @param input - 待检测的数据,任意类型
129
+ * @returns 返回 `true` 则说明该数据 `input` 类型为 `ArrayBuffer` ,且在 Typescript 中进行类型收缩
130
+ * @example
131
+ *
132
+ * ```ts
133
+ * import { isArrayBuffer } from '@mudbean/is';
134
+ *
135
+ * console.log(isArrayBuffer(new ArrayBuffer(8))) // true
136
+ *
137
+ * console.log(isArrayBuffer({})) // false
138
+ * ```
139
+ */
140
+ function isArrayBuffer(input) {
141
+ return typeOf(input) === 'arraybuffer';
142
+ }
143
+ /**
144
+ * # 检测 `input` 是否是 `int8Array` 类型
145
+ *
146
+ * @param input - 待检测的数据,任意类型
147
+ * @returns 返回 `true` 则说明该数据 `input` 类型为 `Int8Array` ,且在 Typescript 中进行类型收缩
148
+ * @example
149
+ *
150
+ * ```ts
151
+ * import { isInt8Array } from '@mudbean/is';
152
+ *
153
+ * console.log(isInt8Array(new Int8Array())) // true
154
+ *
155
+ * console.log(isInt8Array({})) // false
156
+ * console.log(isInt8Array([])) // false
157
+ * console.log(isInt8Array(1)) // false
158
+ * ```
159
+ */
160
+ function isInt8Array(input) {
161
+ return typeOf(input) === 'int8array';
162
+ }
163
+ /**
164
+ * # 检测 `input` 是否是 `uint8Array` 类型
165
+ *
166
+ * @param input - 待检测的数据,任意类型
167
+ * @returns 返回 `true` 则说明该数据 `input` 类型为 `Uint8Array` ,且在 Typescript 中进行类型收缩
168
+ * @example
169
+ *
170
+ * ```ts
171
+ * import { isUint8Array } from '@mudbean/is';
172
+ *
173
+ * console.log(isUint8Array(new Uint8Array())) // true
174
+ *
175
+ * console.log(isUint8Array({})) // false
176
+ * console.log(isUint8Array([])) // false
177
+ * console.log(isUint8Array(1)) // false
178
+ * ```
179
+ */
180
+ function isUint8Array(input) {
181
+ return typeOf(input) === 'uint8array';
182
+ }
183
+ /**
184
+ * # 检测 `input` 是否是 `int16Array` 类型
185
+ *
186
+ * @param input - 待检测的数据,任意类型
187
+ * @returns 返回 `true` 则说明该数据 `input` 类型为 `Int16Array` ,且在 Typescript 中进行类型收缩
188
+ * @example
189
+ *
190
+ * ```ts
191
+ * import { isInt16Array } from '@mudbean/is';
192
+ *
193
+ * console.log(isInt16Array(new Int16Array())) // true
194
+ *
195
+ * console.log(isInt16Array({})) // false
196
+ * console.log(isInt16Array([])) // false
197
+ * console.log(isInt16Array(1)) // false
198
+ * ```
199
+ */
200
+ function isInt16Array(input) {
201
+ return typeOf(input) === 'int16array';
202
+ }
203
+ /**
204
+ * # 检测 `input` 是否是 `uint16Array` 类型
205
+ *
206
+ * @param input - 待检测的数据,任意类型
207
+ * @returns 返回 `true` 则说明该数据 `input` 类型为 `Uint16Array` ,且在 Typescript 中进行类型收缩
208
+ * @example
209
+ *
210
+ * ```ts
211
+ *
212
+ * import { isUint16Array } from '@mudbean/is';
213
+ *
214
+ * console.log(isUint16Array(new Uint16Array())) // true
215
+ *
216
+ * console.log(isUint16Array({})) // false
217
+ * console.log(isUint16Array([])) // false
218
+ * console.log(isUint16Array(1)) // false
219
+ * ```
220
+ */
221
+ function isUint16Array(input) {
222
+ return typeOf(input) === 'uint16array';
223
+ }
224
+ /**
225
+ * # 检测 `input` 是否是 `uint32Array` 类型
226
+ *
227
+ * @param input - 待检测的数据,任意类型
228
+ * @returns 返回 `true` 则说明该数据 `input` 类型为 `Uint32Array` ,且在 Typescript 中进行类型收缩
229
+ * @example
230
+ *
231
+ * ```ts
232
+ * import { isUint32Array } from '@mudbean/is';
233
+ *
234
+ * console.log(isUint32Array(new Uint32Array())) // true
235
+ *
236
+ * console.log(isUint32Array({})) // false
237
+ * console.log(isUint32Array([])) // false
238
+ * console.log(isUint32Array(1)) // false
239
+ * ```
240
+ */
241
+ function isUint32Array(input) {
242
+ return typeOf(input) === 'uint32array';
243
+ }
244
+ /**
245
+ * # 检测 `input` 是否是 `float32Array` 类型
246
+ *
247
+ * @param input - 待检测的数据,任意类型
248
+ * @returns 返回 `true` 则说明该数据 `input` 类型为 `Float32Array` ,且在 Typescript 中进行类型收缩
249
+ * @example
250
+ *
251
+ * ```ts
252
+ * import { isFloat32Array } from '@mudbean/is';
253
+ *
254
+ * console.log(isFloat32Array(new Float32Array())) // true
255
+ *
256
+ * console.log(isFloat32Array({})) // false
257
+ * console.log(isFloat32Array([])) // false
258
+ * console.log(isFloat32Array(1)) // false
259
+ * ```
260
+ */
261
+ function isFloat32Array(input) {
262
+ return typeOf(input) === 'float32array';
263
+ }
264
+ /**
265
+ * # 检测 `input` 是否是 `float64Array` 类型
266
+ *
267
+ * @param input - 待检测的数据,任意类型
268
+ * @returns 返回 `true` 则说明该数据 `input` 类型为 `Float64Array` ,且在 Typescript 中进行类型收缩
269
+ * @example
270
+ *
271
+ * ```ts
272
+ * import { isFloat64Array } from '@mudbean/is';
273
+ *
274
+ * console.log(isFloat64Array(new Float64Array())) // true
275
+ *
276
+ * console.log(isFloat64Array({})) // false
277
+ * console.log(isFloat64Array([])) // false
278
+ * console.log(isFloat64Array(1)) // false
279
+ * ```
280
+ */
281
+ function isFloat64Array(input) {
282
+ return typeOf(input) === 'float64array';
283
+ }
284
+ /**
285
+ * # 检测 `input` 是否是 `sharedArrayBuffer` 类型
286
+ *
287
+ * @param input - 待检测的数据,任意类型
288
+ * @returns 返回 `true` 则说明该数据 `input` 类型为 `SharedArrayBuffer` ,且在 Typescript 中进行类型收缩
289
+ * @example
290
+ *
291
+ * ```ts
292
+ * import { isSharedArrayBuffer } from '@mudbean/is';
293
+ *
294
+ * console.log(isSharedArrayBuffer(new SharedArrayBuffer(8))) // true
295
+ *
296
+ * console.log(isSharedArrayBuffer({})) // false
297
+ * ```
298
+ */
299
+ function isSharedArrayBuffer(input) {
300
+ return typeOf(input) === 'sharedarraybuffer';
301
+ }
302
+ /**
303
+ * # 检测 `input` 是否是 `uint8ClampedArray` 类型
304
+ *
305
+ * @param input - 待检测的数据,任意类型
306
+ * @returns 返回 `true` 则说明该数据 `input` 类型为 `Uint8ClampedArray` ,且在 Typescript 中进行类型收缩
307
+ * @example
308
+ *
309
+ * ```ts
310
+ * import { isUint8ClampedArray } from '@mudbean/is';
311
+ *
312
+ * console.log(isUint8ClampedArray(new Uint8ClampedArray())) // true
313
+ *
314
+ * console.log(isUint8ClampedArray({})) // false
315
+ * console.log(isUint8ClampedArray([])) // false
316
+ * console.log(isUint8ClampedArray(1)) // false
317
+ * ```
318
+ */
319
+ function isUint8ClampedArray(input) {
320
+ return typeOf(input) === 'uint8clampedarray';
321
+ }
322
+
323
+ export { isArray, isArrayBuffer, isBigInt64Array, isBigUint64Array, isEmptyArray, isFloat32Array, isFloat64Array, isInt16Array, isInt8Array, isSet, isSharedArrayBuffer, isUint16Array, isUint32Array, isUint8Array, isUint8ClampedArray, isWeakSet };