@naturalcycles/js-lib 14.183.0 → 14.184.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
@@ -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) {
package/dist/types.d.ts CHANGED
@@ -153,6 +153,12 @@ export type IsoDateString = string;
153
153
  * @example '2019-06-21T05:21:73Z'
154
154
  */
155
155
  export type IsoDateTimeString = string;
156
+ /**
157
+ * Like IsoDateString, but without the Day token.
158
+ *
159
+ * @example '2023-09'
160
+ */
161
+ export type YearMonthString = string;
156
162
  /**
157
163
  * Interface explicitly states that the value is a Unix timestamp (in seconds).
158
164
  *
@@ -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.184.0",
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 {
package/src/types.ts CHANGED
@@ -214,6 +214,13 @@ export type IsoDateString = string
214
214
  */
215
215
  export type IsoDateTimeString = string
216
216
 
217
+ /**
218
+ * Like IsoDateString, but without the Day token.
219
+ *
220
+ * @example '2023-09'
221
+ */
222
+ export type YearMonthString = string
223
+
217
224
  /**
218
225
  * Interface explicitly states that the value is a Unix timestamp (in seconds).
219
226
  *