@matvdt/js-toolkit 0.0.1-canary.17 → 0.0.1-canary.18

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.
@@ -24,10 +24,16 @@ function assertPopulated(field, fieldName = "Field") {
24
24
  }
25
25
  }
26
26
 
27
+ // src/payload-cms/utils/has-id.ts
28
+ function hasId(item) {
29
+ return item.id !== null && item.id !== void 0;
30
+ }
31
+
27
32
  export {
28
33
  isPopulated,
29
34
  asPopulated,
30
35
  MONGO_ID_REGEX,
31
36
  isObjectId,
32
- assertPopulated
37
+ assertPopulated,
38
+ hasId
33
39
  };
package/dist/index.cjs CHANGED
@@ -23,6 +23,7 @@ __export(index_exports, {
23
23
  MONGO_ID_REGEX: () => MONGO_ID_REGEX,
24
24
  asPopulated: () => asPopulated,
25
25
  assertPopulated: () => assertPopulated,
26
+ hasId: () => hasId,
26
27
  isObjectId: () => isObjectId,
27
28
  isPopulated: () => isPopulated
28
29
  });
@@ -53,11 +54,17 @@ function assertPopulated(field, fieldName = "Field") {
53
54
  throw new Error(`${fieldName} is not populated (received ID: ${String(field)})`);
54
55
  }
55
56
  }
57
+
58
+ // src/payload-cms/utils/has-id.ts
59
+ function hasId(item) {
60
+ return item.id !== null && item.id !== void 0;
61
+ }
56
62
  // Annotate the CommonJS export names for ESM import in node:
57
63
  0 && (module.exports = {
58
64
  MONGO_ID_REGEX,
59
65
  asPopulated,
60
66
  assertPopulated,
67
+ hasId,
61
68
  isObjectId,
62
69
  isPopulated
63
70
  });
package/dist/index.js CHANGED
@@ -3,13 +3,15 @@ import {
3
3
  MONGO_ID_REGEX,
4
4
  asPopulated,
5
5
  assertPopulated,
6
+ hasId,
6
7
  isObjectId,
7
8
  isPopulated
8
- } from "./chunk-O4W463W3.js";
9
+ } from "./chunk-OP6OJMXX.js";
9
10
  export {
10
11
  MONGO_ID_REGEX,
11
12
  asPopulated,
12
13
  assertPopulated,
14
+ hasId,
13
15
  isObjectId,
14
16
  isPopulated
15
17
  };
@@ -23,6 +23,7 @@ __export(payload_cms_exports, {
23
23
  MONGO_ID_REGEX: () => MONGO_ID_REGEX,
24
24
  asPopulated: () => asPopulated,
25
25
  assertPopulated: () => assertPopulated,
26
+ hasId: () => hasId,
26
27
  isObjectId: () => isObjectId,
27
28
  isPopulated: () => isPopulated
28
29
  });
@@ -53,11 +54,17 @@ function assertPopulated(field, fieldName = "Field") {
53
54
  throw new Error(`${fieldName} is not populated (received ID: ${String(field)})`);
54
55
  }
55
56
  }
57
+
58
+ // src/payload-cms/utils/has-id.ts
59
+ function hasId(item) {
60
+ return item.id !== null && item.id !== void 0;
61
+ }
56
62
  // Annotate the CommonJS export names for ESM import in node:
57
63
  0 && (module.exports = {
58
64
  MONGO_ID_REGEX,
59
65
  asPopulated,
60
66
  assertPopulated,
67
+ hasId,
61
68
  isObjectId,
62
69
  isPopulated
63
70
  });
@@ -3,13 +3,15 @@ import {
3
3
  MONGO_ID_REGEX,
4
4
  asPopulated,
5
5
  assertPopulated,
6
+ hasId,
6
7
  isObjectId,
7
8
  isPopulated
8
- } from "../chunk-O4W463W3.js";
9
+ } from "../chunk-OP6OJMXX.js";
9
10
  export {
10
11
  MONGO_ID_REGEX,
11
12
  asPopulated,
12
13
  assertPopulated,
14
+ hasId,
13
15
  isObjectId,
14
16
  isPopulated
15
17
  };
@@ -0,0 +1,5 @@
1
+ export declare function hasId<T>(item: T & {
2
+ id?: string | null;
3
+ }): item is T & {
4
+ id: string;
5
+ };
@@ -23,6 +23,7 @@ __export(utils_exports, {
23
23
  MONGO_ID_REGEX: () => MONGO_ID_REGEX,
24
24
  asPopulated: () => asPopulated,
25
25
  assertPopulated: () => assertPopulated,
26
+ hasId: () => hasId,
26
27
  isObjectId: () => isObjectId,
27
28
  isPopulated: () => isPopulated
28
29
  });
@@ -53,11 +54,17 @@ function assertPopulated(field, fieldName = "Field") {
53
54
  throw new Error(`${fieldName} is not populated (received ID: ${String(field)})`);
54
55
  }
55
56
  }
57
+
58
+ // src/payload-cms/utils/has-id.ts
59
+ function hasId(item) {
60
+ return item.id !== null && item.id !== void 0;
61
+ }
56
62
  // Annotate the CommonJS export names for ESM import in node:
57
63
  0 && (module.exports = {
58
64
  MONGO_ID_REGEX,
59
65
  asPopulated,
60
66
  assertPopulated,
67
+ hasId,
61
68
  isObjectId,
62
69
  isPopulated
63
70
  });
@@ -1,4 +1,5 @@
1
1
  export * from './as-populated';
2
2
  export * from './assert-populated';
3
+ export * from './has-id';
3
4
  export * from './is-object-id';
4
5
  export * from './is-populated';
@@ -2,13 +2,15 @@ import {
2
2
  MONGO_ID_REGEX,
3
3
  asPopulated,
4
4
  assertPopulated,
5
+ hasId,
5
6
  isObjectId,
6
7
  isPopulated
7
- } from "../../chunk-O4W463W3.js";
8
+ } from "../../chunk-OP6OJMXX.js";
8
9
  export {
9
10
  MONGO_ID_REGEX,
10
11
  asPopulated,
11
12
  assertPopulated,
13
+ hasId,
12
14
  isObjectId,
13
15
  isPopulated
14
16
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@matvdt/js-toolkit",
3
- "version": "0.0.1-canary.17",
3
+ "version": "0.0.1-canary.18",
4
4
  "description": "JS/TS toolkit",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",