@naturalcycles/js-lib 14.183.0 → 14.183.1

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
@@ -22,6 +22,8 @@ export declare const _isTruthy: <T>(v: T) => v is Truthy<T>;
22
22
  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
+ *
26
+ * Currently treats RegEx as Object too, e.g _isObject(/some/) === true
25
27
  */
26
28
  export declare function _isObject(obj: any): obj is AnyObject;
27
29
  export declare function _isPrimitive(v: any): v is Primitive;
package/dist/is.util.js CHANGED
@@ -26,9 +26,11 @@ const _isFalsy = (v) => !v;
26
26
  exports._isFalsy = _isFalsy;
27
27
  /**
28
28
  * Returns true if item is Object, not null and not Array.
29
+ *
30
+ * Currently treats RegEx as Object too, e.g _isObject(/some/) === true
29
31
  */
30
32
  function _isObject(obj) {
31
- return obj?.constructor === Object;
33
+ return (typeof obj === 'object' && obj !== null && !Array.isArray(obj)) || false;
32
34
  }
33
35
  exports._isObject = _isObject;
34
36
  function _isPrimitive(v) {
@@ -17,9 +17,11 @@ export const _isTruthy = (v) => !!v;
17
17
  export const _isFalsy = (v) => !v;
18
18
  /**
19
19
  * Returns true if item is Object, not null and not Array.
20
+ *
21
+ * Currently treats RegEx as Object too, e.g _isObject(/some/) === true
20
22
  */
21
23
  export function _isObject(obj) {
22
- return (obj === null || obj === void 0 ? void 0 : obj.constructor) === Object;
24
+ return (typeof obj === 'object' && obj !== null && !Array.isArray(obj)) || false;
23
25
  }
24
26
  export function _isPrimitive(v) {
25
27
  return (v === null ||
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@naturalcycles/js-lib",
3
- "version": "14.183.0",
3
+ "version": "14.183.1",
4
4
  "scripts": {
5
5
  "prepare": "husky install",
6
6
  "build-prod": "build-prod-esm-cjs",
package/src/is.util.ts CHANGED
@@ -26,9 +26,11 @@ export const _isFalsy = <T>(v: T): v is Falsy<T> => !v
26
26
 
27
27
  /**
28
28
  * Returns true if item is Object, not null and not Array.
29
+ *
30
+ * Currently treats RegEx as Object too, e.g _isObject(/some/) === true
29
31
  */
30
32
  export function _isObject(obj: any): obj is AnyObject {
31
- return obj?.constructor === Object
33
+ return (typeof obj === 'object' && obj !== null && !Array.isArray(obj)) || false
32
34
  }
33
35
 
34
36
  export function _isPrimitive(v: any): v is Primitive {