es-toolkit 1.20.0-dev.630 → 1.20.0-dev.631

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.
@@ -139,6 +139,7 @@ export { isSymbol } from './predicate/isSymbol.mjs';
139
139
  export { isObject } from './predicate/isObject.mjs';
140
140
  export { isObjectLike } from './predicate/isObjectLike.mjs';
141
141
  export { isBoolean } from './predicate/isBoolean.mjs';
142
+ export { isError } from './predicate/isError.mjs';
142
143
  export { isTypedArray } from './predicate/isTypedArray.mjs';
143
144
  export { isMatch } from './predicate/isMatch.mjs';
144
145
  export { isRegExp } from './predicate/isRegExp.mjs';
@@ -139,6 +139,7 @@ export { isSymbol } from './predicate/isSymbol.js';
139
139
  export { isObject } from './predicate/isObject.js';
140
140
  export { isObjectLike } from './predicate/isObjectLike.js';
141
141
  export { isBoolean } from './predicate/isBoolean.js';
142
+ export { isError } from './predicate/isError.js';
142
143
  export { isTypedArray } from './predicate/isTypedArray.js';
143
144
  export { isMatch } from './predicate/isMatch.js';
144
145
  export { isRegExp } from './predicate/isRegExp.js';
@@ -1246,6 +1246,10 @@ function isBoolean(x) {
1246
1246
  return false;
1247
1247
  }
1248
1248
 
1249
+ function isError(value) {
1250
+ return isWeakSet$1.getTag(value) === '[object Error]';
1251
+ }
1252
+
1249
1253
  function isRegExp(value) {
1250
1254
  return isWeakSet$1.getTag(value) === '[object RegExp]';
1251
1255
  }
@@ -1736,6 +1740,7 @@ exports.isArray = isArray;
1736
1740
  exports.isArrayLike = isArrayLike;
1737
1741
  exports.isArrayLikeObject = isArrayLikeObject;
1738
1742
  exports.isBoolean = isBoolean;
1743
+ exports.isError = isError;
1739
1744
  exports.isInteger = isInteger;
1740
1745
  exports.isMatch = isMatch;
1741
1746
  exports.isNaN = isNaN;
@@ -139,6 +139,7 @@ export { isArrayLike } from './predicate/isArrayLike.mjs';
139
139
  export { isSymbol } from './predicate/isSymbol.mjs';
140
140
  export { isObject } from './predicate/isObject.mjs';
141
141
  export { isBoolean } from './predicate/isBoolean.mjs';
142
+ export { isError } from './predicate/isError.mjs';
142
143
  export { isTypedArray } from './predicate/isTypedArray.mjs';
143
144
  export { isMatch } from './predicate/isMatch.mjs';
144
145
  export { isRegExp } from './predicate/isRegExp.mjs';
@@ -0,0 +1,16 @@
1
+ /**
2
+ * Checks if `value` is an Error object.
3
+ *
4
+ * @param {unknown} value The value to check.
5
+ * @returns {value is Error} Returns `true` if `value` is an Error object, `false` otherwise.
6
+ *
7
+ * @example
8
+ * ```typescript
9
+ * console.log(isError(new Error())); // true
10
+ * console.log(isError('Error')); // false
11
+ * console.log(isError({ name: 'Error', message: '' })); // false
12
+ * ```
13
+ */
14
+ declare function isError(value?: unknown): value is Error;
15
+
16
+ export { isError };
@@ -0,0 +1,16 @@
1
+ /**
2
+ * Checks if `value` is an Error object.
3
+ *
4
+ * @param {unknown} value The value to check.
5
+ * @returns {value is Error} Returns `true` if `value` is an Error object, `false` otherwise.
6
+ *
7
+ * @example
8
+ * ```typescript
9
+ * console.log(isError(new Error())); // true
10
+ * console.log(isError('Error')); // false
11
+ * console.log(isError({ name: 'Error', message: '' })); // false
12
+ * ```
13
+ */
14
+ declare function isError(value?: unknown): value is Error;
15
+
16
+ export { isError };
@@ -0,0 +1,7 @@
1
+ import { getTag } from '../_internal/getTag.mjs';
2
+
3
+ function isError(value) {
4
+ return getTag(value) === '[object Error]';
5
+ }
6
+
7
+ export { isError };
package/dist/index.d.mts CHANGED
@@ -96,6 +96,7 @@ export { toMerged } from './object/toMerged.mjs';
96
96
  export { mergeWith } from './object/mergeWith.mjs';
97
97
  export { isDate } from './predicate/isDate.mjs';
98
98
  export { isEqual } from './predicate/isEqual.mjs';
99
+ export { isError } from './predicate/isError.mjs';
99
100
  export { isNil } from './predicate/isNil.mjs';
100
101
  export { isNotNil } from './predicate/isNotNil.mjs';
101
102
  export { isNull } from './predicate/isNull.mjs';
package/dist/index.d.ts CHANGED
@@ -96,6 +96,7 @@ export { toMerged } from './object/toMerged.js';
96
96
  export { mergeWith } from './object/mergeWith.js';
97
97
  export { isDate } from './predicate/isDate.js';
98
98
  export { isEqual } from './predicate/isEqual.js';
99
+ export { isError } from './predicate/isError.js';
99
100
  export { isNil } from './predicate/isNil.js';
100
101
  export { isNotNil } from './predicate/isNotNil.js';
101
102
  export { isNull } from './predicate/isNull.js';
package/dist/index.js CHANGED
@@ -13,8 +13,8 @@ const math_index = require('./math/index.js');
13
13
  const object_index = require('./object/index.js');
14
14
  const toMerged = require('./_chunk/toMerged-Bzkqyz.js');
15
15
  const isWeakSet = require('./_chunk/isWeakSet-E_VMwB.js');
16
- const isPlainObject = require('./_chunk/isPlainObject-BIekvL.js');
17
16
  const predicate_index = require('./predicate/index.js');
17
+ const isPlainObject = require('./_chunk/isPlainObject-BIekvL.js');
18
18
  const string_index = require('./string/index.js');
19
19
 
20
20
 
@@ -128,13 +128,14 @@ exports.isNull = isWeakSet.isNull;
128
128
  exports.isUndefined = isWeakSet.isUndefined;
129
129
  exports.isWeakMap = isWeakSet.isWeakMap;
130
130
  exports.isWeakSet = isWeakSet.isWeakSet;
131
- exports.isPlainObject = isPlainObject.isPlainObject;
132
- exports.isPrimitive = isPlainObject.isPrimitive;
133
- exports.isTypedArray = isPlainObject.isTypedArray;
134
131
  exports.isBoolean = predicate_index.isBoolean;
132
+ exports.isError = predicate_index.isError;
135
133
  exports.isRegExp = predicate_index.isRegExp;
136
134
  exports.isString = predicate_index.isString;
137
135
  exports.isSymbol = predicate_index.isSymbol;
136
+ exports.isPlainObject = isPlainObject.isPlainObject;
137
+ exports.isPrimitive = isPlainObject.isPrimitive;
138
+ exports.isTypedArray = isPlainObject.isTypedArray;
138
139
  exports.camelCase = string_index.camelCase;
139
140
  exports.capitalize = string_index.capitalize;
140
141
  exports.deburr = string_index.deburr;
package/dist/index.mjs CHANGED
@@ -96,6 +96,7 @@ export { toMerged } from './object/toMerged.mjs';
96
96
  export { mergeWith } from './object/mergeWith.mjs';
97
97
  export { isDate } from './predicate/isDate.mjs';
98
98
  export { isEqual } from './predicate/isEqual.mjs';
99
+ export { isError } from './predicate/isError.mjs';
99
100
  export { isNil } from './predicate/isNil.mjs';
100
101
  export { isNotNil } from './predicate/isNotNil.mjs';
101
102
  export { isNull } from './predicate/isNull.mjs';
@@ -1,5 +1,6 @@
1
1
  export { isDate } from './isDate.mjs';
2
2
  export { isEqual } from './isEqual.mjs';
3
+ export { isError } from './isError.mjs';
3
4
  export { isNil } from './isNil.mjs';
4
5
  export { isNotNil } from './isNotNil.mjs';
5
6
  export { isNull } from './isNull.mjs';
@@ -1,5 +1,6 @@
1
1
  export { isDate } from './isDate.js';
2
2
  export { isEqual } from './isEqual.js';
3
+ export { isError } from './isError.js';
3
4
  export { isNil } from './isNil.js';
4
5
  export { isNotNil } from './isNotNil.js';
5
6
  export { isNull } from './isNull.js';
@@ -5,6 +5,10 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
5
5
  const isWeakSet = require('../_chunk/isWeakSet-E_VMwB.js');
6
6
  const isPlainObject = require('../_chunk/isPlainObject-BIekvL.js');
7
7
 
8
+ function isError(value) {
9
+ return value instanceof Error;
10
+ }
11
+
8
12
  function isRegExp(value) {
9
13
  return value instanceof RegExp;
10
14
  }
@@ -35,6 +39,7 @@ exports.isPlainObject = isPlainObject.isPlainObject;
35
39
  exports.isPrimitive = isPlainObject.isPrimitive;
36
40
  exports.isTypedArray = isPlainObject.isTypedArray;
37
41
  exports.isBoolean = isBoolean;
42
+ exports.isError = isError;
38
43
  exports.isRegExp = isRegExp;
39
44
  exports.isString = isString;
40
45
  exports.isSymbol = isSymbol;
@@ -1,5 +1,6 @@
1
1
  export { isDate } from './isDate.mjs';
2
2
  export { isEqual } from './isEqual.mjs';
3
+ export { isError } from './isError.mjs';
3
4
  export { isNil } from './isNil.mjs';
4
5
  export { isNotNil } from './isNotNil.mjs';
5
6
  export { isNull } from './isNull.mjs';
@@ -0,0 +1,16 @@
1
+ /**
2
+ * Checks if `value` is an Error object.
3
+ *
4
+ * @param {unknown} value The value to check.
5
+ * @returns {value is Error} Returns `true` if `value` is an Error object, `false` otherwise.
6
+ *
7
+ * @example
8
+ * ```typescript
9
+ * console.log(isError(new Error())); // true
10
+ * console.log(isError('Error')); // false
11
+ * console.log(isError({ name: 'Error', message: '' })); // false
12
+ * ```
13
+ */
14
+ declare function isError(value: unknown): value is Error;
15
+
16
+ export { isError };
@@ -0,0 +1,16 @@
1
+ /**
2
+ * Checks if `value` is an Error object.
3
+ *
4
+ * @param {unknown} value The value to check.
5
+ * @returns {value is Error} Returns `true` if `value` is an Error object, `false` otherwise.
6
+ *
7
+ * @example
8
+ * ```typescript
9
+ * console.log(isError(new Error())); // true
10
+ * console.log(isError('Error')); // false
11
+ * console.log(isError({ name: 'Error', message: '' })); // false
12
+ * ```
13
+ */
14
+ declare function isError(value: unknown): value is Error;
15
+
16
+ export { isError };
@@ -0,0 +1,5 @@
1
+ function isError(value) {
2
+ return value instanceof Error;
3
+ }
4
+
5
+ export { isError };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "es-toolkit",
3
3
  "description": "A state-of-the-art, high-performance JavaScript utility library with a small bundle size and strong type annotations.",
4
- "version": "1.20.0-dev.630+0061e902",
4
+ "version": "1.20.0-dev.631+ea01c771",
5
5
  "homepage": "https://es-toolkit.slash.page",
6
6
  "bugs": "https://github.com/toss/es-toolkit/issues",
7
7
  "repository": {