what-are-you 0.1.3 → 0.1.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.
- package/dist/cjs/index.d.ts +194 -3
- package/dist/cjs/index.d.ts.map +1 -1
- package/dist/cjs/index.js +318 -34
- package/dist/cjs/index.js.map +1 -1
- package/dist/esm/index.d.ts +194 -3
- package/dist/esm/index.d.ts.map +1 -1
- package/dist/esm/index.js +288 -3
- package/dist/esm/index.js.map +1 -1
- package/package.json +1 -1
- package/src/index.ts +303 -36
- package/dist/cjs/get-text.d.ts +0 -36
- package/dist/cjs/get-text.d.ts.map +0 -1
- package/dist/cjs/get-text.js +0 -115
- package/dist/cjs/get-text.js.map +0 -1
- package/dist/cjs/is-basic.d.ts +0 -122
- package/dist/cjs/is-basic.d.ts.map +0 -1
- package/dist/cjs/is-basic.js +0 -156
- package/dist/cjs/is-basic.js.map +0 -1
- package/dist/cjs/is-special.d.ts +0 -39
- package/dist/cjs/is-special.d.ts.map +0 -1
- package/dist/cjs/is-special.js +0 -59
- package/dist/cjs/is-special.js.map +0 -1
- package/dist/esm/get-text.d.ts +0 -36
- package/dist/esm/get-text.d.ts.map +0 -1
- package/dist/esm/get-text.js +0 -107
- package/dist/esm/get-text.js.map +0 -1
- package/dist/esm/is-basic.d.ts +0 -122
- package/dist/esm/is-basic.d.ts.map +0 -1
- package/dist/esm/is-basic.js +0 -136
- package/dist/esm/is-basic.js.map +0 -1
- package/dist/esm/is-special.d.ts +0 -39
- package/dist/esm/is-special.d.ts.map +0 -1
- package/dist/esm/is-special.js +0 -51
- package/dist/esm/is-special.js.map +0 -1
- package/src/get-text.ts +0 -115
- package/src/is-basic.ts +0 -143
- package/src/is-special.ts +0 -57
package/dist/cjs/is-basic.js
DELETED
|
@@ -1,156 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.isSymbol = exports.isError = exports.isPosInt = exports.isPair = exports.isNotNullish = exports.isBool = exports.isNatOrInfinity = exports.isNat = exports.isIntOrInfinity = exports.isInt = exports.isNumber = exports.isThenable = exports.isArray = exports.isNullish = exports.isPropertyKey = exports.isString = exports.isBigInt = void 0;
|
|
4
|
-
exports.isObject = isObject;
|
|
5
|
-
exports.isFunction = isFunction;
|
|
6
|
-
/**
|
|
7
|
-
* Checks if the given value is an object.
|
|
8
|
-
*
|
|
9
|
-
* @template T - The type of the value to check.
|
|
10
|
-
* @param value - The value to test.
|
|
11
|
-
*/
|
|
12
|
-
function isObject(value) {
|
|
13
|
-
return typeof value === "object" && value != null;
|
|
14
|
-
}
|
|
15
|
-
/**
|
|
16
|
-
* Checks if the given value is a function.
|
|
17
|
-
*
|
|
18
|
-
* @param value - The value to check.
|
|
19
|
-
*/
|
|
20
|
-
function isFunction(value) {
|
|
21
|
-
return typeof value === "function";
|
|
22
|
-
}
|
|
23
|
-
/**
|
|
24
|
-
* Checks if the given value is a BigInt.
|
|
25
|
-
*
|
|
26
|
-
* @param value - The value to check.
|
|
27
|
-
*/
|
|
28
|
-
const isBigInt = (value) => {
|
|
29
|
-
return typeof value === "bigint";
|
|
30
|
-
};
|
|
31
|
-
exports.isBigInt = isBigInt;
|
|
32
|
-
/**
|
|
33
|
-
* Checks if the given value is a string.
|
|
34
|
-
*
|
|
35
|
-
* @param value - The value to check.
|
|
36
|
-
*/
|
|
37
|
-
const isString = (value) => {
|
|
38
|
-
return typeof value === "string";
|
|
39
|
-
};
|
|
40
|
-
exports.isString = isString;
|
|
41
|
-
/**
|
|
42
|
-
* Checks if the given value is acceptable as the key of a property.
|
|
43
|
-
*
|
|
44
|
-
* That is, whether it's a string, a number, or a symbol.
|
|
45
|
-
*
|
|
46
|
-
* @param value - The value to check.
|
|
47
|
-
*/
|
|
48
|
-
const isPropertyKey = (value) => {
|
|
49
|
-
return (0, exports.isString)(value) || (0, exports.isSymbol)(value) || (0, exports.isNumber)(value);
|
|
50
|
-
};
|
|
51
|
-
exports.isPropertyKey = isPropertyKey;
|
|
52
|
-
/**
|
|
53
|
-
* Checks if the given value is null or undefined.
|
|
54
|
-
*
|
|
55
|
-
* @param value - The value to check.
|
|
56
|
-
*/
|
|
57
|
-
const isNullish = (value) => {
|
|
58
|
-
return value == null;
|
|
59
|
-
};
|
|
60
|
-
exports.isNullish = isNullish;
|
|
61
|
-
/**
|
|
62
|
-
* Checks if the given value is an array.
|
|
63
|
-
*
|
|
64
|
-
* @param value - The value to check.
|
|
65
|
-
*/
|
|
66
|
-
exports.isArray = Array.isArray;
|
|
67
|
-
/**
|
|
68
|
-
* Checks if the given value is a thenable (i.e., a Promise or similar).
|
|
69
|
-
*
|
|
70
|
-
* @template T - Allows asserting the type of the resolved value. Not part of the check.
|
|
71
|
-
* @param what - The value to check.
|
|
72
|
-
*/
|
|
73
|
-
const isThenable = (what) => {
|
|
74
|
-
return isObject(what) && isFunction(what.then);
|
|
75
|
-
};
|
|
76
|
-
exports.isThenable = isThenable;
|
|
77
|
-
/**
|
|
78
|
-
* Checks if the given value is a number.
|
|
79
|
-
*
|
|
80
|
-
* @param v - The value to check.
|
|
81
|
-
*/
|
|
82
|
-
const isNumber = (v) => +v === v;
|
|
83
|
-
exports.isNumber = isNumber;
|
|
84
|
-
/**
|
|
85
|
-
* Checks if the given value is a number and can be represented exactly in JavaScript.
|
|
86
|
-
*
|
|
87
|
-
* That is, if it's a number in the range (-2⁵³, 2⁵³).
|
|
88
|
-
*
|
|
89
|
-
* @param v - The value to check.
|
|
90
|
-
*/
|
|
91
|
-
exports.isInt = Number.isSafeInteger;
|
|
92
|
-
/**
|
|
93
|
-
* Checks if the given value is either a {@link isInt safe integer} or Infinity.
|
|
94
|
-
*
|
|
95
|
-
* @param v - The value to check.
|
|
96
|
-
*/
|
|
97
|
-
const isIntOrInfinity = (v) => (0, exports.isInt)(v) || v === Infinity;
|
|
98
|
-
exports.isIntOrInfinity = isIntOrInfinity;
|
|
99
|
-
/**
|
|
100
|
-
* Checks if the given value is a {@link isInt safe integer} and non-negative.
|
|
101
|
-
*
|
|
102
|
-
* @param v - The value to check.
|
|
103
|
-
* @see {@link isInt}
|
|
104
|
-
*/
|
|
105
|
-
const isNat = (v) => (0, exports.isInt)(v) && v >= 0;
|
|
106
|
-
exports.isNat = isNat;
|
|
107
|
-
/**
|
|
108
|
-
* Checks if the given value is either a non-negative {@link isInt safe integer} or Infinity.
|
|
109
|
-
*
|
|
110
|
-
* @param v - The value to check.
|
|
111
|
-
*/
|
|
112
|
-
const isNatOrInfinity = (v) => (0, exports.isIntOrInfinity)(v) && v >= 0;
|
|
113
|
-
exports.isNatOrInfinity = isNatOrInfinity;
|
|
114
|
-
/**
|
|
115
|
-
* Checks if the given value is a boolean.
|
|
116
|
-
*
|
|
117
|
-
* @param value - The value to check.
|
|
118
|
-
*/
|
|
119
|
-
const isBool = (value) => !!value === value;
|
|
120
|
-
exports.isBool = isBool;
|
|
121
|
-
/**
|
|
122
|
-
* Checks if the given value is not null or undefined.
|
|
123
|
-
*
|
|
124
|
-
* @param value - The value to check.
|
|
125
|
-
*/
|
|
126
|
-
const isNotNullish = (value) => !(0, exports.isNullish)(value);
|
|
127
|
-
exports.isNotNullish = isNotNullish;
|
|
128
|
-
/**
|
|
129
|
-
* Checks if the given value is an array of two elements.
|
|
130
|
-
*
|
|
131
|
-
* @param value - The value to check.
|
|
132
|
-
*/
|
|
133
|
-
const isPair = (value) => (0, exports.isArray)(value) && value.length === 2;
|
|
134
|
-
exports.isPair = isPair;
|
|
135
|
-
/**
|
|
136
|
-
* Checks if the given value is a {@link isInt safe integer} and positive.
|
|
137
|
-
*
|
|
138
|
-
* @param value - The value to check.
|
|
139
|
-
*/
|
|
140
|
-
const isPosInt = (value) => (0, exports.isInt)(value) && value > 0;
|
|
141
|
-
exports.isPosInt = isPosInt;
|
|
142
|
-
/**
|
|
143
|
-
* Checks if the given value is an Error object.
|
|
144
|
-
*
|
|
145
|
-
* @param value - The value to check.
|
|
146
|
-
*/
|
|
147
|
-
const isError = (value) => value instanceof Error;
|
|
148
|
-
exports.isError = isError;
|
|
149
|
-
/**
|
|
150
|
-
* Checks if the given value is a symbol.
|
|
151
|
-
*
|
|
152
|
-
* @param value - The value to check.
|
|
153
|
-
*/
|
|
154
|
-
const isSymbol = (value) => typeof value === "symbol";
|
|
155
|
-
exports.isSymbol = isSymbol;
|
|
156
|
-
//# sourceMappingURL=is-basic.js.map
|
package/dist/cjs/is-basic.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"is-basic.js","sourceRoot":"","sources":["../../src/is-basic.ts"],"names":[],"mappings":";;;AAMA,4BAEC;AAOD,gCAEC;AAjBD;;;;;GAKG;AACH,SAAgB,QAAQ,CAAI,KAAQ;IAChC,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,IAAI,IAAI,CAAA;AACrD,CAAC;AAED;;;;GAIG;AACH,SAAgB,UAAU,CAAC,KAAc;IACrC,OAAO,OAAO,KAAK,KAAK,UAAU,CAAA;AACtC,CAAC;AAED;;;;GAIG;AACI,MAAM,QAAQ,GAAG,CAAC,KAAU,EAAmB,EAAE;IACpD,OAAO,OAAO,KAAK,KAAK,QAAQ,CAAA;AACpC,CAAC,CAAA;AAFY,QAAA,QAAQ,YAEpB;AAED;;;;GAIG;AACI,MAAM,QAAQ,GAAG,CAAC,KAAU,EAAmB,EAAE;IACpD,OAAO,OAAO,KAAK,KAAK,QAAQ,CAAA;AACpC,CAAC,CAAA;AAFY,QAAA,QAAQ,YAEpB;AACD;;;;;;GAMG;AACI,MAAM,aAAa,GAAG,CAAC,KAAU,EAAwB,EAAE;IAC9D,OAAO,IAAA,gBAAQ,EAAC,KAAK,CAAC,IAAI,IAAA,gBAAQ,EAAC,KAAK,CAAC,IAAI,IAAA,gBAAQ,EAAC,KAAK,CAAC,CAAA;AAChE,CAAC,CAAA;AAFY,QAAA,aAAa,iBAEzB;AAED;;;;GAIG;AACI,MAAM,SAAS,GAAG,CAAC,KAAU,EAA6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EAAC,KAAK,CAAC,CAAA;AAAhD,QAAA,YAAY,gBAAoC;AAC7D;;;;GAIG;AACI,MAAM,MAAM,GAAG,CAAC,KAAU,EAAE,EAAE,CAAC,IAAA,eAAO,EAAC,KAAK,CAAC,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC,CAAA;AAA7D,QAAA,MAAM,UAAuD;AAC1E;;;;GAIG;AACI,MAAM,QAAQ,GAAG,CAAC,KAAa,EAAE,EAAE,CAAC,IAAA,aAAK,EAAC,KAAK,CAAC,IAAI,KAAK,GAAG,CAAC,CAAA;AAAvD,QAAA,QAAQ,YAA+C;AACpE;;;;GAIG;AACI,MAAM,OAAO,GAAG,CAAC,KAAU,EAAE,EAAE,CAAC,KAAK,YAAY,KAAK,CAAA;AAAhD,QAAA,OAAO,WAAyC;AAC7D;;;;GAIG;AACI,MAAM,QAAQ,GAAG,CAAC,KAAU,EAAE,EAAE,CAAC,OAAO,KAAK,KAAK,QAAQ,CAAA;AAApD,QAAA,QAAQ,YAA4C"}
|
package/dist/cjs/is-special.d.ts
DELETED
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Checks if the given value is array-like. It must be an object and have an integer `length`
|
|
3
|
-
* property.
|
|
4
|
-
*
|
|
5
|
-
* @template T - Allows asserting the element type. Not part of the check.
|
|
6
|
-
* @param value - The value to check.
|
|
7
|
-
*/
|
|
8
|
-
export declare function isArrayLike<T>(value: any): value is ArrayLike<T>;
|
|
9
|
-
/**
|
|
10
|
-
* Checks if the given value is an object
|
|
11
|
-
*
|
|
12
|
-
* @param value - The value to check.
|
|
13
|
-
*/
|
|
14
|
-
export declare function isIterable<T>(value: any): value is Iterable<T>;
|
|
15
|
-
/**
|
|
16
|
-
* Checks if the given value is an iterable or async iterable.
|
|
17
|
-
*
|
|
18
|
-
* @template T - Allows asserting the element type. Not part of the check.
|
|
19
|
-
* @param value - The value to check.
|
|
20
|
-
*/
|
|
21
|
-
export declare function isAnyIterable<T = unknown>(value: any): value is Iterable<T>;
|
|
22
|
-
/**
|
|
23
|
-
* Checks if the given value is an async iterable.
|
|
24
|
-
*
|
|
25
|
-
* @template T - Allows asserting the element type. Not part of the check.
|
|
26
|
-
* @param value - The value to check.
|
|
27
|
-
*/
|
|
28
|
-
export declare function isAsyncIterable<T>(value: any): value is AsyncIterable<T>;
|
|
29
|
-
export declare function isNextable<T>(value: any): value is Iterator<T> | AsyncIterator<T>;
|
|
30
|
-
/**
|
|
31
|
-
* Checks if the given value is a Doddle object.
|
|
32
|
-
*
|
|
33
|
-
* @param value - The value to check.
|
|
34
|
-
* @returns True if the value is a Doddle object, false otherwise.
|
|
35
|
-
*/
|
|
36
|
-
export declare function isDoddle<T>(value: any): value is {
|
|
37
|
-
pull(): T;
|
|
38
|
-
};
|
|
39
|
-
//# sourceMappingURL=is-special.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"is-special.d.ts","sourceRoot":"","sources":["../../src/is-special.ts"],"names":[],"mappings":"AAEA;;;;;;GAMG;AACH,wBAAgB,WAAW,CAAC,CAAC,EAAE,KAAK,EAAE,GAAG,GAAG,KAAK,IAAI,SAAS,CAAC,CAAC,CAAC,CAEhE;AAED;;;;GAIG;AACH,wBAAgB,UAAU,CAAC,CAAC,EAAE,KAAK,EAAE,GAAG,GAAG,KAAK,IAAI,QAAQ,CAAC,CAAC,CAAC,CAE9D;AACD;;;;;GAKG;AACH,wBAAgB,aAAa,CAAC,CAAC,GAAG,OAAO,EAAE,KAAK,EAAE,GAAG,GAAG,KAAK,IAAI,QAAQ,CAAC,CAAC,CAAC,CAE3E;AAED;;;;;GAKG;AACH,wBAAgB,eAAe,CAAC,CAAC,EAAE,KAAK,EAAE,GAAG,GAAG,KAAK,IAAI,aAAa,CAAC,CAAC,CAAC,CAExE;AAED,wBAAgB,UAAU,CAAC,CAAC,EAAE,KAAK,EAAE,GAAG,GAAG,KAAK,IAAI,QAAQ,CAAC,CAAC,CAAC,GAAG,aAAa,CAAC,CAAC,CAAC,CAGjF;AAED;;;;;GAKG;AACH,wBAAgB,QAAQ,CAAC,CAAC,EAAE,KAAK,EAAE,GAAG,GAAG,KAAK,IAAI;IAC9C,IAAI,IAAI,CAAC,CAAA;CACZ,CAEA"}
|
package/dist/cjs/is-special.js
DELETED
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.isArrayLike = isArrayLike;
|
|
4
|
-
exports.isIterable = isIterable;
|
|
5
|
-
exports.isAnyIterable = isAnyIterable;
|
|
6
|
-
exports.isAsyncIterable = isAsyncIterable;
|
|
7
|
-
exports.isNextable = isNextable;
|
|
8
|
-
exports.isDoddle = isDoddle;
|
|
9
|
-
const is_basic_js_1 = require("./is-basic.js");
|
|
10
|
-
/**
|
|
11
|
-
* Checks if the given value is array-like. It must be an object and have an integer `length`
|
|
12
|
-
* property.
|
|
13
|
-
*
|
|
14
|
-
* @template T - Allows asserting the element type. Not part of the check.
|
|
15
|
-
* @param value - The value to check.
|
|
16
|
-
*/
|
|
17
|
-
function isArrayLike(value) {
|
|
18
|
-
return (0, is_basic_js_1.isObject)(value) && !(0, is_basic_js_1.isFunction)(value) && (0, is_basic_js_1.isInt)(value.length);
|
|
19
|
-
}
|
|
20
|
-
/**
|
|
21
|
-
* Checks if the given value is an object
|
|
22
|
-
*
|
|
23
|
-
* @param value - The value to check.
|
|
24
|
-
*/
|
|
25
|
-
function isIterable(value) {
|
|
26
|
-
return (0, is_basic_js_1.isObject)(value) && (0, is_basic_js_1.isFunction)(value[Symbol.iterator]);
|
|
27
|
-
}
|
|
28
|
-
/**
|
|
29
|
-
* Checks if the given value is an iterable or async iterable.
|
|
30
|
-
*
|
|
31
|
-
* @template T - Allows asserting the element type. Not part of the check.
|
|
32
|
-
* @param value - The value to check.
|
|
33
|
-
*/
|
|
34
|
-
function isAnyIterable(value) {
|
|
35
|
-
return isIterable(value) || isAsyncIterable(value);
|
|
36
|
-
}
|
|
37
|
-
/**
|
|
38
|
-
* Checks if the given value is an async iterable.
|
|
39
|
-
*
|
|
40
|
-
* @template T - Allows asserting the element type. Not part of the check.
|
|
41
|
-
* @param value - The value to check.
|
|
42
|
-
*/
|
|
43
|
-
function isAsyncIterable(value) {
|
|
44
|
-
return (0, is_basic_js_1.isObject)(value) && (0, is_basic_js_1.isFunction)(value[Symbol.asyncIterator]);
|
|
45
|
-
}
|
|
46
|
-
function isNextable(value) {
|
|
47
|
-
// Checks if value is an iterator
|
|
48
|
-
return (0, is_basic_js_1.isObject)(value) && (0, is_basic_js_1.isFunction)(value.next);
|
|
49
|
-
}
|
|
50
|
-
/**
|
|
51
|
-
* Checks if the given value is a Doddle object.
|
|
52
|
-
*
|
|
53
|
-
* @param value - The value to check.
|
|
54
|
-
* @returns True if the value is a Doddle object, false otherwise.
|
|
55
|
-
*/
|
|
56
|
-
function isDoddle(value) {
|
|
57
|
-
return (0, is_basic_js_1.isObject)(value) && typeof value.pull === "function" && typeof value.map === "function";
|
|
58
|
-
}
|
|
59
|
-
//# sourceMappingURL=is-special.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"is-special.js","sourceRoot":"","sources":["../../src/is-special.ts"],"names":[],"mappings":";;AASA,kCAEC;AAOD,gCAEC;AAOD,sCAEC;AAQD,0CAEC;AAED,gCAGC;AAQD,4BAIC;AAxDD,+CAA2D;AAE3D;;;;;;GAMG;AACH,SAAgB,WAAW,CAAI,KAAU;IACrC,OAAO,IAAA,sBAAQ,EAAC,KAAK,CAAC,IAAI,CAAC,IAAA,wBAAU,EAAC,KAAK,CAAC,IAAI,IAAA,mBAAK,EAAC,KAAK,CAAC,MAAM,CAAC,CAAA;AACvE,CAAC;AAED;;;;GAIG;AACH,SAAgB,UAAU,CAAI,KAAU;IACpC,OAAO,IAAA,sBAAQ,EAAC,KAAK,CAAC,IAAI,IAAA,wBAAU,EAAC,KAAK,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAA;AAChE,CAAC;AACD;;;;;GAKG;AACH,SAAgB,aAAa,CAAc,KAAU;IACjD,OAAO,UAAU,CAAC,KAAK,CAAC,IAAI,eAAe,CAAC,KAAK,CAAC,CAAA;AACtD,CAAC;AAED;;;;;GAKG;AACH,SAAgB,eAAe,CAAI,KAAU;IACzC,OAAO,IAAA,sBAAQ,EAAC,KAAK,CAAC,IAAI,IAAA,wBAAU,EAAC,KAAK,CAAC,MAAM,CAAC,aAAa,CAAC,CAAC,CAAA;AACrE,CAAC;AAED,SAAgB,UAAU,CAAI,KAAU;IACpC,iCAAiC;IACjC,OAAO,IAAA,sBAAQ,EAAC,KAAK,CAAC,IAAI,IAAA,wBAAU,EAAC,KAAK,CAAC,IAAI,CAAC,CAAA;AACpD,CAAC;AAED;;;;;GAKG;AACH,SAAgB,QAAQ,CAAI,KAAU;IAGlC,OAAO,IAAA,sBAAQ,EAAC,KAAK,CAAC,IAAI,OAAO,KAAK,CAAC,IAAI,KAAK,UAAU,IAAI,OAAO,KAAK,CAAC,GAAG,KAAK,UAAU,CAAA;AACjG,CAAC"}
|
package/dist/esm/get-text.d.ts
DELETED
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Gets a short value type name, which can be used in a message.
|
|
3
|
-
*
|
|
4
|
-
* @param value - The value to check.
|
|
5
|
-
*/
|
|
6
|
-
export declare function getNiceTypeOf(value: any): "string" | "number" | "bigint" | "boolean" | "symbol" | "undefined" | "object" | "function" | "null";
|
|
7
|
-
/**
|
|
8
|
-
* Describes an object's class, type, or constructor name to be used in a message.
|
|
9
|
-
*
|
|
10
|
-
* - 📦 For an object, returns the name of its constructor or similar string.
|
|
11
|
-
* - ⚙️ For a function (or class), returns the function's name.
|
|
12
|
-
* - 🔠 For other values, returns the `typeof` string via {@link getNiceTypeOf}.
|
|
13
|
-
*
|
|
14
|
-
* @param something - The value whose class name or type is to be determined.
|
|
15
|
-
*/
|
|
16
|
-
export declare function getNiceClassName(something: any): any;
|
|
17
|
-
export declare function getObjectStringTag(object: any): any;
|
|
18
|
-
/**
|
|
19
|
-
* Gets the description of a symbol.
|
|
20
|
-
*
|
|
21
|
-
* @param symbol - The symbol to get the description of.
|
|
22
|
-
*/
|
|
23
|
-
export declare function getSymbolDescription(symbol: symbol): string;
|
|
24
|
-
/**
|
|
25
|
-
* Gets a short string describing a value, to be used in a message.
|
|
26
|
-
*
|
|
27
|
-
* @param value - The value to describe.
|
|
28
|
-
*/
|
|
29
|
-
export declare function getNiceValueName(value: any): string;
|
|
30
|
-
/**
|
|
31
|
-
* Gets the name of a function, or null if it has no name.
|
|
32
|
-
*
|
|
33
|
-
* @param func - The function to get the name of.
|
|
34
|
-
*/
|
|
35
|
-
export declare function getFunctionName(func: Function): string | undefined;
|
|
36
|
-
//# sourceMappingURL=get-text.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"get-text.d.ts","sourceRoot":"","sources":["../../src/get-text.ts"],"names":[],"mappings":"AAWA;;;;GAIG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,GAAG,wGAEvC;AACD;;;;;;;;GAQG;AACH,wBAAgB,gBAAgB,CAAC,SAAS,EAAE,GAAG,OAgB9C;AAED,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,GAAG,OAE7C;AACD;;;;GAIG;AACH,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,MAAM,UAElD;AAqBD;;;;GAIG;AACH,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,GAAG,UAuB1C;AAED;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,IAAI,EAAE,QAAQ,sBAE7C"}
|
package/dist/esm/get-text.js
DELETED
|
@@ -1,107 +0,0 @@
|
|
|
1
|
-
import { isBigInt, isFunction, isNullish, isObject, isString, isSymbol, isThenable } from "./is-basic.js";
|
|
2
|
-
import { isAsyncIterable, isDoddle, isIterable, isNextable } from "./is-special.js";
|
|
3
|
-
/**
|
|
4
|
-
* Gets a short value type name, which can be used in a message.
|
|
5
|
-
*
|
|
6
|
-
* @param value - The value to check.
|
|
7
|
-
*/
|
|
8
|
-
export function getNiceTypeOf(value) {
|
|
9
|
-
return value === null ? "null" : typeof value;
|
|
10
|
-
}
|
|
11
|
-
/**
|
|
12
|
-
* Describes an object's class, type, or constructor name to be used in a message.
|
|
13
|
-
*
|
|
14
|
-
* - 📦 For an object, returns the name of its constructor or similar string.
|
|
15
|
-
* - ⚙️ For a function (or class), returns the function's name.
|
|
16
|
-
* - 🔠 For other values, returns the `typeof` string via {@link getNiceTypeOf}.
|
|
17
|
-
*
|
|
18
|
-
* @param something - The value whose class name or type is to be determined.
|
|
19
|
-
*/
|
|
20
|
-
export function getNiceClassName(something) {
|
|
21
|
-
if (isFunction(something)) {
|
|
22
|
-
return getFunctionName(something);
|
|
23
|
-
}
|
|
24
|
-
if (!isObject(something)) {
|
|
25
|
-
return getNiceTypeOf(something);
|
|
26
|
-
}
|
|
27
|
-
if (something === null) {
|
|
28
|
-
return "null";
|
|
29
|
-
}
|
|
30
|
-
let name;
|
|
31
|
-
if (something.constructor) {
|
|
32
|
-
name = getFunctionName(something.constructor);
|
|
33
|
-
}
|
|
34
|
-
return name && name !== "Object" ? name : (getObjectStringTag(something) ?? "Object");
|
|
35
|
-
}
|
|
36
|
-
export function getObjectStringTag(object) {
|
|
37
|
-
return object[Symbol.toStringTag];
|
|
38
|
-
}
|
|
39
|
-
/**
|
|
40
|
-
* Gets the description of a symbol.
|
|
41
|
-
*
|
|
42
|
-
* @param symbol - The symbol to get the description of.
|
|
43
|
-
*/
|
|
44
|
-
export function getSymbolDescription(symbol) {
|
|
45
|
-
return `${symbol.description}`;
|
|
46
|
-
}
|
|
47
|
-
function _getShortObjectString(object) {
|
|
48
|
-
if (isDoddle(object)) {
|
|
49
|
-
return object.toString();
|
|
50
|
-
}
|
|
51
|
-
if (isIterable(object)) {
|
|
52
|
-
return `iterable ${getNiceClassName(object)}`;
|
|
53
|
-
}
|
|
54
|
-
else if (isAsyncIterable(object)) {
|
|
55
|
-
return `async iterable ${getNiceClassName(object)}`;
|
|
56
|
-
}
|
|
57
|
-
else if (isNextable(object)) {
|
|
58
|
-
return `iterator ${getNiceClassName(object)}`;
|
|
59
|
-
}
|
|
60
|
-
else if (isDoddle(object)) {
|
|
61
|
-
return object.toString();
|
|
62
|
-
}
|
|
63
|
-
else if (isThenable(object)) {
|
|
64
|
-
return `a Promise`;
|
|
65
|
-
}
|
|
66
|
-
else {
|
|
67
|
-
return `object ${getNiceClassName(object)}`;
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
/**
|
|
71
|
-
* Gets a short string describing a value, to be used in a message.
|
|
72
|
-
*
|
|
73
|
-
* @param value - The value to describe.
|
|
74
|
-
*/
|
|
75
|
-
export function getNiceValueName(value) {
|
|
76
|
-
if (isNullish(value)) {
|
|
77
|
-
return `${value}`;
|
|
78
|
-
}
|
|
79
|
-
if (isFunction(value)) {
|
|
80
|
-
return `function ${getFunctionName(value) || "<anonymous>"}`;
|
|
81
|
-
}
|
|
82
|
-
if (isBigInt(value)) {
|
|
83
|
-
return `${value}n`;
|
|
84
|
-
}
|
|
85
|
-
if (isSymbol(value)) {
|
|
86
|
-
return `Symbol(${getSymbolDescription(value)})`;
|
|
87
|
-
}
|
|
88
|
-
if (isString(value)) {
|
|
89
|
-
if (value.length > 30) {
|
|
90
|
-
value = value.slice(0, 30) + "⋯";
|
|
91
|
-
}
|
|
92
|
-
return `"${value}"`;
|
|
93
|
-
}
|
|
94
|
-
if (isObject(value)) {
|
|
95
|
-
return _getShortObjectString(value);
|
|
96
|
-
}
|
|
97
|
-
return `${value}`;
|
|
98
|
-
}
|
|
99
|
-
/**
|
|
100
|
-
* Gets the name of a function, or null if it has no name.
|
|
101
|
-
*
|
|
102
|
-
* @param func - The function to get the name of.
|
|
103
|
-
*/
|
|
104
|
-
export function getFunctionName(func) {
|
|
105
|
-
return func.name || undefined;
|
|
106
|
-
}
|
|
107
|
-
//# sourceMappingURL=get-text.js.map
|
package/dist/esm/get-text.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"get-text.js","sourceRoot":"","sources":["../../src/get-text.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,QAAQ,EACR,UAAU,EACV,SAAS,EACT,QAAQ,EACR,QAAQ,EACR,QAAQ,EACR,UAAU,EACb,MAAM,eAAe,CAAA;AACtB,OAAO,EAAE,eAAe,EAAE,QAAQ,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAA;AAEnF;;;;GAIG;AACH,MAAM,UAAU,aAAa,CAAC,KAAU;IACpC,OAAO,KAAK,KAAK,IAAI,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,OAAO,KAAK,CAAA;AACjD,CAAC;AACD;;;;;;;;GAQG;AACH,MAAM,UAAU,gBAAgB,CAAC,SAAc;IAC3C,IAAI,UAAU,CAAC,SAAS,CAAC,EAAE,CAAC;QACxB,OAAO,eAAe,CAAC,SAAS,CAAC,CAAA;IACrC,CAAC;IACD,IAAI,CAAC,QAAQ,CAAC,SAAS,CAAC,EAAE,CAAC;QACvB,OAAO,aAAa,CAAC,SAAS,CAAC,CAAA;IACnC,CAAC;IACD,IAAI,SAAS,KAAK,IAAI,EAAE,CAAC;QACrB,OAAO,MAAM,CAAA;IACjB,CAAC;IAED,IAAI,IAAwB,CAAA;IAC5B,IAAI,SAAS,CAAC,WAAW,EAAE,CAAC;QACxB,IAAI,GAAG,eAAe,CAAC,SAAS,CAAC,WAAW,CAAC,CAAA;IACjD,CAAC;IACD,OAAO,IAAI,IAAI,IAAI,KAAK,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,kBAAkB,CAAC,SAAS,CAAC,IAAI,QAAQ,CAAC,CAAA;AACzF,CAAC;AAED,MAAM,UAAU,kBAAkB,CAAC,MAAW;IAC1C,OAAO,MAAM,CAAC,MAAM,CAAC,WAAW,CAAC,CAAA;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,GAAG,KAAK,GAAG,CAAA;IACtB,CAAC;IACD,IAAI,QAAQ,CAAC,KAAK,CAAC,EAAE,CAAC;QAClB,OAAO,UAAU,oBAAoB,CAAC,KAAK,CAAC,GAAG,CAAA;IACnD,CAAC;IACD,IAAI,QAAQ,CAAC,KAAK,CAAC,EAAE,CAAC;QAClB,IAAI,KAAK,CAAC,MAAM,GAAG,EAAE,EAAE,CAAC;YACpB,KAAK,GAAG,KAAK,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC,GAAG,GAAG,CAAA;QACpC,CAAC;QACD,OAAO,IAAI,KAAK,GAAG,CAAA;IACvB,CAAC;IACD,IAAI,QAAQ,CAAC,KAAK,CAAC,EAAE,CAAC;QAClB,OAAO,qBAAqB,CAAC,KAAK,CAAC,CAAA;IACvC,CAAC;IACD,OAAO,GAAG,KAAK,EAAE,CAAA;AACrB,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,eAAe,CAAC,IAAc;IAC1C,OAAO,IAAI,CAAC,IAAI,IAAI,SAAS,CAAA;AACjC,CAAC"}
|
package/dist/esm/is-basic.d.ts
DELETED
|
@@ -1,122 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Checks if the given value is an object.
|
|
3
|
-
*
|
|
4
|
-
* @template T - The type of the value to check.
|
|
5
|
-
* @param value - The value to test.
|
|
6
|
-
*/
|
|
7
|
-
export declare function isObject<T>(value: T): value is T & {};
|
|
8
|
-
/**
|
|
9
|
-
* Checks if the given value is a function.
|
|
10
|
-
*
|
|
11
|
-
* @param value - The value to check.
|
|
12
|
-
*/
|
|
13
|
-
export declare function isFunction(value: unknown): value is Function;
|
|
14
|
-
/**
|
|
15
|
-
* Checks if the given value is a BigInt.
|
|
16
|
-
*
|
|
17
|
-
* @param value - The value to check.
|
|
18
|
-
*/
|
|
19
|
-
export declare const isBigInt: (value: any) => value is bigint;
|
|
20
|
-
/**
|
|
21
|
-
* Checks if the given value is a string.
|
|
22
|
-
*
|
|
23
|
-
* @param value - The value to check.
|
|
24
|
-
*/
|
|
25
|
-
export declare const isString: (value: any) => value is string;
|
|
26
|
-
/**
|
|
27
|
-
* Checks if the given value is acceptable as the key of a property.
|
|
28
|
-
*
|
|
29
|
-
* That is, whether it's a string, a number, or a symbol.
|
|
30
|
-
*
|
|
31
|
-
* @param value - The value to check.
|
|
32
|
-
*/
|
|
33
|
-
export declare const isPropertyKey: (value: any) => value is PropertyKey;
|
|
34
|
-
/**
|
|
35
|
-
* Checks if the given value is null or undefined.
|
|
36
|
-
*
|
|
37
|
-
* @param value - The value to check.
|
|
38
|
-
*/
|
|
39
|
-
export declare const isNullish: (value: any) => value is null | undefined;
|
|
40
|
-
/**
|
|
41
|
-
* Checks if the given value is an array.
|
|
42
|
-
*
|
|
43
|
-
* @param value - The value to check.
|
|
44
|
-
*/
|
|
45
|
-
export declare const isArray: (arg: any) => arg is any[];
|
|
46
|
-
/**
|
|
47
|
-
* Checks if the given value is a thenable (i.e., a Promise or similar).
|
|
48
|
-
*
|
|
49
|
-
* @template T - Allows asserting the type of the resolved value. Not part of the check.
|
|
50
|
-
* @param what - The value to check.
|
|
51
|
-
*/
|
|
52
|
-
export declare const isThenable: <T = unknown>(what: unknown) => what is PromiseLike<T>;
|
|
53
|
-
/**
|
|
54
|
-
* Checks if the given value is a number.
|
|
55
|
-
*
|
|
56
|
-
* @param v - The value to check.
|
|
57
|
-
*/
|
|
58
|
-
export declare const isNumber: (v: number) => boolean;
|
|
59
|
-
/**
|
|
60
|
-
* Checks if the given value is a number and can be represented exactly in JavaScript.
|
|
61
|
-
*
|
|
62
|
-
* That is, if it's a number in the range (-2⁵³, 2⁵³).
|
|
63
|
-
*
|
|
64
|
-
* @param v - The value to check.
|
|
65
|
-
*/
|
|
66
|
-
export declare const isInt: (number: unknown) => boolean;
|
|
67
|
-
/**
|
|
68
|
-
* Checks if the given value is either a {@link isInt safe integer} or Infinity.
|
|
69
|
-
*
|
|
70
|
-
* @param v - The value to check.
|
|
71
|
-
*/
|
|
72
|
-
export declare const isIntOrInfinity: (v: number) => boolean;
|
|
73
|
-
/**
|
|
74
|
-
* Checks if the given value is a {@link isInt safe integer} and non-negative.
|
|
75
|
-
*
|
|
76
|
-
* @param v - The value to check.
|
|
77
|
-
* @see {@link isInt}
|
|
78
|
-
*/
|
|
79
|
-
export declare const isNat: (v: number) => boolean;
|
|
80
|
-
/**
|
|
81
|
-
* Checks if the given value is either a non-negative {@link isInt safe integer} or Infinity.
|
|
82
|
-
*
|
|
83
|
-
* @param v - The value to check.
|
|
84
|
-
*/
|
|
85
|
-
export declare const isNatOrInfinity: (v: number) => boolean;
|
|
86
|
-
/**
|
|
87
|
-
* Checks if the given value is a boolean.
|
|
88
|
-
*
|
|
89
|
-
* @param value - The value to check.
|
|
90
|
-
*/
|
|
91
|
-
export declare const isBool: (value: boolean) => boolean;
|
|
92
|
-
/**
|
|
93
|
-
* Checks if the given value is not null or undefined.
|
|
94
|
-
*
|
|
95
|
-
* @param value - The value to check.
|
|
96
|
-
*/
|
|
97
|
-
export declare const isNotNullish: (value: any) => boolean;
|
|
98
|
-
/**
|
|
99
|
-
* Checks if the given value is an array of two elements.
|
|
100
|
-
*
|
|
101
|
-
* @param value - The value to check.
|
|
102
|
-
*/
|
|
103
|
-
export declare const isPair: (value: any) => boolean;
|
|
104
|
-
/**
|
|
105
|
-
* Checks if the given value is a {@link isInt safe integer} and positive.
|
|
106
|
-
*
|
|
107
|
-
* @param value - The value to check.
|
|
108
|
-
*/
|
|
109
|
-
export declare const isPosInt: (value: number) => boolean;
|
|
110
|
-
/**
|
|
111
|
-
* Checks if the given value is an Error object.
|
|
112
|
-
*
|
|
113
|
-
* @param value - The value to check.
|
|
114
|
-
*/
|
|
115
|
-
export declare const isError: (value: any) => value is Error;
|
|
116
|
-
/**
|
|
117
|
-
* Checks if the given value is a symbol.
|
|
118
|
-
*
|
|
119
|
-
* @param value - The value to check.
|
|
120
|
-
*/
|
|
121
|
-
export declare const isSymbol: (value: any) => value is symbol;
|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AAC1E;;;;GAIG;AACH,eAAO,MAAM,MAAM,GAAI,OAAO,OAAO,YAAsB,CAAA;AAC3D;;;;GAIG;AACH,eAAO,MAAM,YAAY,GAAI,OAAO,GAAG,YAAsB,CAAA;AAC7D;;;;GAIG;AACH,eAAO,MAAM,MAAM,GAAI,OAAO,GAAG,YAAyC,CAAA;AAC1E;;;;GAIG;AACH,eAAO,MAAM,QAAQ,GAAI,OAAO,MAAM,YAA8B,CAAA;AACpE;;;;GAIG;AACH,eAAO,MAAM,OAAO,GAAI,OAAO,GAAG,mBAA2B,CAAA;AAC7D;;;;GAIG;AACH,eAAO,MAAM,QAAQ,GAAI,OAAO,GAAG,oBAA8B,CAAA"}
|
package/dist/esm/is-basic.js
DELETED
|
@@ -1,136 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Checks if the given value is an object.
|
|
3
|
-
*
|
|
4
|
-
* @template T - The type of the value to check.
|
|
5
|
-
* @param value - The value to test.
|
|
6
|
-
*/
|
|
7
|
-
export function isObject(value) {
|
|
8
|
-
return typeof value === "object" && value != null;
|
|
9
|
-
}
|
|
10
|
-
/**
|
|
11
|
-
* Checks if the given value is a function.
|
|
12
|
-
*
|
|
13
|
-
* @param value - The value to check.
|
|
14
|
-
*/
|
|
15
|
-
export function isFunction(value) {
|
|
16
|
-
return typeof value === "function";
|
|
17
|
-
}
|
|
18
|
-
/**
|
|
19
|
-
* Checks if the given value is a BigInt.
|
|
20
|
-
*
|
|
21
|
-
* @param value - The value to check.
|
|
22
|
-
*/
|
|
23
|
-
export const isBigInt = (value) => {
|
|
24
|
-
return typeof value === "bigint";
|
|
25
|
-
};
|
|
26
|
-
/**
|
|
27
|
-
* Checks if the given value is a string.
|
|
28
|
-
*
|
|
29
|
-
* @param value - The value to check.
|
|
30
|
-
*/
|
|
31
|
-
export const isString = (value) => {
|
|
32
|
-
return typeof value === "string";
|
|
33
|
-
};
|
|
34
|
-
/**
|
|
35
|
-
* Checks if the given value is acceptable as the key of a property.
|
|
36
|
-
*
|
|
37
|
-
* That is, whether it's a string, a number, or a symbol.
|
|
38
|
-
*
|
|
39
|
-
* @param value - The value to check.
|
|
40
|
-
*/
|
|
41
|
-
export const isPropertyKey = (value) => {
|
|
42
|
-
return isString(value) || isSymbol(value) || isNumber(value);
|
|
43
|
-
};
|
|
44
|
-
/**
|
|
45
|
-
* Checks if the given value is null or undefined.
|
|
46
|
-
*
|
|
47
|
-
* @param value - The value to check.
|
|
48
|
-
*/
|
|
49
|
-
export const isNullish = (value) => {
|
|
50
|
-
return value == null;
|
|
51
|
-
};
|
|
52
|
-
/**
|
|
53
|
-
* Checks if the given value is an array.
|
|
54
|
-
*
|
|
55
|
-
* @param value - The value to check.
|
|
56
|
-
*/
|
|
57
|
-
export const isArray = Array.isArray;
|
|
58
|
-
/**
|
|
59
|
-
* Checks if the given value is a thenable (i.e., a Promise or similar).
|
|
60
|
-
*
|
|
61
|
-
* @template T - Allows asserting the type of the resolved value. Not part of the check.
|
|
62
|
-
* @param what - The value to check.
|
|
63
|
-
*/
|
|
64
|
-
export const isThenable = (what) => {
|
|
65
|
-
return isObject(what) && isFunction(what.then);
|
|
66
|
-
};
|
|
67
|
-
/**
|
|
68
|
-
* Checks if the given value is a number.
|
|
69
|
-
*
|
|
70
|
-
* @param v - The value to check.
|
|
71
|
-
*/
|
|
72
|
-
export const isNumber = (v) => +v === v;
|
|
73
|
-
/**
|
|
74
|
-
* Checks if the given value is a number and can be represented exactly in JavaScript.
|
|
75
|
-
*
|
|
76
|
-
* That is, if it's a number in the range (-2⁵³, 2⁵³).
|
|
77
|
-
*
|
|
78
|
-
* @param v - The value to check.
|
|
79
|
-
*/
|
|
80
|
-
export const isInt = Number.isSafeInteger;
|
|
81
|
-
/**
|
|
82
|
-
* Checks if the given value is either a {@link isInt safe integer} or Infinity.
|
|
83
|
-
*
|
|
84
|
-
* @param v - The value to check.
|
|
85
|
-
*/
|
|
86
|
-
export const isIntOrInfinity = (v) => isInt(v) || v === Infinity;
|
|
87
|
-
/**
|
|
88
|
-
* Checks if the given value is a {@link isInt safe integer} and non-negative.
|
|
89
|
-
*
|
|
90
|
-
* @param v - The value to check.
|
|
91
|
-
* @see {@link isInt}
|
|
92
|
-
*/
|
|
93
|
-
export const isNat = (v) => isInt(v) && v >= 0;
|
|
94
|
-
/**
|
|
95
|
-
* Checks if the given value is either a non-negative {@link isInt safe integer} or Infinity.
|
|
96
|
-
*
|
|
97
|
-
* @param v - The value to check.
|
|
98
|
-
*/
|
|
99
|
-
export const isNatOrInfinity = (v) => isIntOrInfinity(v) && v >= 0;
|
|
100
|
-
/**
|
|
101
|
-
* Checks if the given value is a boolean.
|
|
102
|
-
*
|
|
103
|
-
* @param value - The value to check.
|
|
104
|
-
*/
|
|
105
|
-
export const isBool = (value) => !!value === value;
|
|
106
|
-
/**
|
|
107
|
-
* Checks if the given value is not null or undefined.
|
|
108
|
-
*
|
|
109
|
-
* @param value - The value to check.
|
|
110
|
-
*/
|
|
111
|
-
export const isNotNullish = (value) => !isNullish(value);
|
|
112
|
-
/**
|
|
113
|
-
* Checks if the given value is an array of two elements.
|
|
114
|
-
*
|
|
115
|
-
* @param value - The value to check.
|
|
116
|
-
*/
|
|
117
|
-
export const isPair = (value) => isArray(value) && value.length === 2;
|
|
118
|
-
/**
|
|
119
|
-
* Checks if the given value is a {@link isInt safe integer} and positive.
|
|
120
|
-
*
|
|
121
|
-
* @param value - The value to check.
|
|
122
|
-
*/
|
|
123
|
-
export const isPosInt = (value) => isInt(value) && value > 0;
|
|
124
|
-
/**
|
|
125
|
-
* Checks if the given value is an Error object.
|
|
126
|
-
*
|
|
127
|
-
* @param value - The value to check.
|
|
128
|
-
*/
|
|
129
|
-
export const isError = (value) => value instanceof Error;
|
|
130
|
-
/**
|
|
131
|
-
* Checks if the given value is a symbol.
|
|
132
|
-
*
|
|
133
|
-
* @param value - The value to check.
|
|
134
|
-
*/
|
|
135
|
-
export const isSymbol = (value) => typeof value === "symbol";
|
|
136
|
-
//# sourceMappingURL=is-basic.js.map
|