@naturalcycles/js-lib 14.178.0 → 14.179.0

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/is.util.d.ts CHANGED
@@ -23,9 +23,9 @@ export declare const _isFalsy: <T>(v: T) => v is Falsy<T>;
23
23
  /**
24
24
  * Returns true if item is Object, not null and not Array.
25
25
  */
26
- export declare function _isObject(item: any): item is AnyObject;
26
+ export declare function _isObject(obj: any): obj is AnyObject;
27
27
  export declare function _isPrimitive(v: any): v is Primitive;
28
- export declare function _isEmptyObject(obj: any): boolean;
28
+ export declare function _isEmptyObject(obj: AnyObject): boolean;
29
29
  /**
30
30
  * Object is considered empty if it's one of:
31
31
  * undefined
package/dist/is.util.js CHANGED
@@ -27,8 +27,8 @@ exports._isFalsy = _isFalsy;
27
27
  /**
28
28
  * Returns true if item is Object, not null and not Array.
29
29
  */
30
- function _isObject(item) {
31
- return (typeof item === 'object' && item !== null && !Array.isArray(item)) || false;
30
+ function _isObject(obj) {
31
+ return obj?.constructor === Object;
32
32
  }
33
33
  exports._isObject = _isObject;
34
34
  function _isPrimitive(v) {
@@ -42,7 +42,7 @@ function _isPrimitive(v) {
42
42
  }
43
43
  exports._isPrimitive = _isPrimitive;
44
44
  function _isEmptyObject(obj) {
45
- return obj && obj.constructor === Object && Object.keys(obj).length === 0;
45
+ return Object.keys(obj).length === 0;
46
46
  }
47
47
  exports._isEmptyObject = _isEmptyObject;
48
48
  /**
@@ -18,8 +18,8 @@ export const _isFalsy = (v) => !v;
18
18
  /**
19
19
  * Returns true if item is Object, not null and not Array.
20
20
  */
21
- export function _isObject(item) {
22
- return (typeof item === 'object' && item !== null && !Array.isArray(item)) || false;
21
+ export function _isObject(obj) {
22
+ return (obj === null || obj === void 0 ? void 0 : obj.constructor) === Object;
23
23
  }
24
24
  export function _isPrimitive(v) {
25
25
  return (v === null ||
@@ -31,7 +31,7 @@ export function _isPrimitive(v) {
31
31
  typeof v === 'symbol');
32
32
  }
33
33
  export function _isEmptyObject(obj) {
34
- return obj && obj.constructor === Object && Object.keys(obj).length === 0;
34
+ return Object.keys(obj).length === 0;
35
35
  }
36
36
  /**
37
37
  * Object is considered empty if it's one of:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@naturalcycles/js-lib",
3
- "version": "14.178.0",
3
+ "version": "14.179.0",
4
4
  "scripts": {
5
5
  "prepare": "husky install",
6
6
  "build-prod": "build-prod-esm-cjs",
package/src/is.util.ts CHANGED
@@ -27,8 +27,8 @@ export const _isFalsy = <T>(v: T): v is Falsy<T> => !v
27
27
  /**
28
28
  * Returns true if item is Object, not null and not Array.
29
29
  */
30
- export function _isObject(item: any): item is AnyObject {
31
- return (typeof item === 'object' && item !== null && !Array.isArray(item)) || false
30
+ export function _isObject(obj: any): obj is AnyObject {
31
+ return obj?.constructor === Object
32
32
  }
33
33
 
34
34
  export function _isPrimitive(v: any): v is Primitive {
@@ -43,8 +43,8 @@ export function _isPrimitive(v: any): v is Primitive {
43
43
  )
44
44
  }
45
45
 
46
- export function _isEmptyObject(obj: any): boolean {
47
- return obj && obj.constructor === Object && Object.keys(obj).length === 0
46
+ export function _isEmptyObject(obj: AnyObject): boolean {
47
+ return Object.keys(obj).length === 0
48
48
  }
49
49
 
50
50
  /**