es-toolkit 1.17.0-dev.567 → 1.17.0-dev.568

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.
@@ -142,6 +142,7 @@ export { isArray } from './predicate/isArray.mjs';
142
142
  export { isArguments } from './predicate/isArguments.mjs';
143
143
  export { isArrayLike } from './predicate/isArrayLike.mjs';
144
144
  export { isSymbol } from './predicate/isSymbol.mjs';
145
+ export { isObject } from './predicate/isObject.mjs';
145
146
  export { isObjectLike } from './predicate/isObjectLike.mjs';
146
147
  export { isBoolean } from './predicate/isBoolean.mjs';
147
148
  export { isTypedArray } from './predicate/isTypedArray.mjs';
@@ -142,6 +142,7 @@ export { isArray } from './predicate/isArray.js';
142
142
  export { isArguments } from './predicate/isArguments.js';
143
143
  export { isArrayLike } from './predicate/isArrayLike.js';
144
144
  export { isSymbol } from './predicate/isSymbol.js';
145
+ export { isObject } from './predicate/isObject.js';
145
146
  export { isObjectLike } from './predicate/isObjectLike.js';
146
147
  export { isBoolean } from './predicate/isBoolean.js';
147
148
  export { isTypedArray } from './predicate/isTypedArray.js';
@@ -927,6 +927,11 @@ function isArray(value) {
927
927
  return Array.isArray(value);
928
928
  }
929
929
 
930
+ function isObject(value) {
931
+ const type = typeof value;
932
+ return value !== null && (type === 'object' || type === 'function');
933
+ }
934
+
930
935
  function isBoolean(x) {
931
936
  if (x === true || x === false) {
932
937
  return true;
@@ -1182,6 +1187,7 @@ exports.isArray = isArray;
1182
1187
  exports.isArrayLike = isArrayLike;
1183
1188
  exports.isBoolean = isBoolean;
1184
1189
  exports.isMatch = isMatch;
1190
+ exports.isObject = isObject;
1185
1191
  exports.isPlainObject = isPlainObject;
1186
1192
  exports.isRegExp = isRegExp;
1187
1193
  exports.isString = isString;
@@ -143,6 +143,7 @@ export { isArray } from './predicate/isArray.mjs';
143
143
  export { isArguments } from './predicate/isArguments.mjs';
144
144
  export { isArrayLike } from './predicate/isArrayLike.mjs';
145
145
  export { isSymbol } from './predicate/isSymbol.mjs';
146
+ export { isObject } from './predicate/isObject.mjs';
146
147
  export { isBoolean } from './predicate/isBoolean.mjs';
147
148
  export { isTypedArray } from './predicate/isTypedArray.mjs';
148
149
  export { isMatch } from './predicate/isMatch.mjs';
@@ -0,0 +1,26 @@
1
+ /**
2
+ * Checks if the given value is the language type of Object.
3
+ * https://262.ecma-international.org/7.0/#sec-ecmascript-language-types
4
+ *
5
+ * This function tests whether the provided value is an object or not.
6
+ * It returns `true` if the value is an object, and `false` otherwise.
7
+ *
8
+ * This function can also serve as a type predicate in TypeScript, narrowing the type of the argument to an object value.
9
+ *
10
+ * @param {unknown} value - The value to check if it is an object.
11
+ * @returns {value is object} `true` if the value is the language type of Object, `false` otherwise.
12
+ *
13
+ * @example
14
+ * const value1 = {};
15
+ * const value2 = [1, 2, 3];
16
+ * const value3 = () => {};
17
+ * const value4 = null;
18
+ *
19
+ * console.log(isArray(value1)); // true
20
+ * console.log(isArray(value2)); // true
21
+ * console.log(isArray(value3)); // true
22
+ * console.log(isArray(value4)); // false
23
+ */
24
+ declare function isObject(value: unknown): value is object;
25
+
26
+ export { isObject };
@@ -0,0 +1,26 @@
1
+ /**
2
+ * Checks if the given value is the language type of Object.
3
+ * https://262.ecma-international.org/7.0/#sec-ecmascript-language-types
4
+ *
5
+ * This function tests whether the provided value is an object or not.
6
+ * It returns `true` if the value is an object, and `false` otherwise.
7
+ *
8
+ * This function can also serve as a type predicate in TypeScript, narrowing the type of the argument to an object value.
9
+ *
10
+ * @param {unknown} value - The value to check if it is an object.
11
+ * @returns {value is object} `true` if the value is the language type of Object, `false` otherwise.
12
+ *
13
+ * @example
14
+ * const value1 = {};
15
+ * const value2 = [1, 2, 3];
16
+ * const value3 = () => {};
17
+ * const value4 = null;
18
+ *
19
+ * console.log(isArray(value1)); // true
20
+ * console.log(isArray(value2)); // true
21
+ * console.log(isArray(value3)); // true
22
+ * console.log(isArray(value4)); // false
23
+ */
24
+ declare function isObject(value: unknown): value is object;
25
+
26
+ export { isObject };
@@ -0,0 +1,6 @@
1
+ function isObject(value) {
2
+ const type = typeof value;
3
+ return value !== null && (type === 'object' || type === 'function');
4
+ }
5
+
6
+ export { isObject };
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.17.0-dev.567+5d4b59e8",
4
+ "version": "1.17.0-dev.568+40c9ab92",
5
5
  "homepage": "https://es-toolkit.slash.page",
6
6
  "bugs": "https://github.com/toss/es-toolkit/issues",
7
7
  "repository": {