@worknice/utils 0.0.3 → 0.0.4

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.
Files changed (72) hide show
  1. package/dist/index.d.ts +19 -4
  2. package/dist/index.js +38 -8
  3. package/dist/index.js.map +1 -1
  4. package/dist/temporal/MAX_INSTANT.d.ts +5 -0
  5. package/dist/temporal/MAX_INSTANT.js +7 -0
  6. package/dist/temporal/MAX_INSTANT.js.map +1 -0
  7. package/dist/temporal/MAX_PLAIN_DATE.d.ts +5 -0
  8. package/dist/temporal/MAX_PLAIN_DATE.js +7 -0
  9. package/dist/temporal/MAX_PLAIN_DATE.js.map +1 -0
  10. package/dist/temporal/MIN_INSTANT.d.ts +5 -0
  11. package/dist/temporal/MIN_INSTANT.js +7 -0
  12. package/dist/temporal/MIN_INSTANT.js.map +1 -0
  13. package/dist/temporal/MIN_PLAIN_DATE.d.ts +5 -0
  14. package/dist/temporal/MIN_PLAIN_DATE.js +7 -0
  15. package/dist/temporal/MIN_PLAIN_DATE.js.map +1 -0
  16. package/dist/temporal/compareInstants.d.ts +11 -0
  17. package/dist/temporal/compareInstants.js +15 -0
  18. package/dist/temporal/compareInstants.js.map +1 -0
  19. package/dist/temporal/comparePlainDates.d.ts +11 -0
  20. package/dist/temporal/comparePlainDates.js +15 -0
  21. package/dist/temporal/comparePlainDates.js.map +1 -0
  22. package/dist/temporal/convertPlainDateToInstant.d.ts +5 -0
  23. package/dist/temporal/convertPlainDateToInstant.js +6 -0
  24. package/dist/temporal/convertPlainDateToInstant.js.map +1 -0
  25. package/dist/temporal/envCheck.js.map +1 -0
  26. package/dist/temporal/isInstantAfter.d.ts +7 -0
  27. package/dist/temporal/isInstantAfter.js +8 -0
  28. package/dist/temporal/isInstantAfter.js.map +1 -0
  29. package/dist/temporal/isInstantBefore.d.ts +7 -0
  30. package/dist/temporal/isInstantBefore.js +8 -0
  31. package/dist/temporal/isInstantBefore.js.map +1 -0
  32. package/dist/temporal/isPlainDateAfter.d.ts +7 -0
  33. package/dist/temporal/isPlainDateAfter.js +8 -0
  34. package/dist/temporal/isPlainDateAfter.js.map +1 -0
  35. package/dist/temporal/isPlainDateBefore.d.ts +7 -0
  36. package/dist/temporal/isPlainDateBefore.js +8 -0
  37. package/dist/temporal/isPlainDateBefore.js.map +1 -0
  38. package/dist/temporal/isSamePlainDate.d.ts +9 -0
  39. package/dist/temporal/isSamePlainDate.js +9 -0
  40. package/dist/temporal/isSamePlainDate.js.map +1 -0
  41. package/dist/temporal/isValidInstant.d.ts +5 -0
  42. package/dist/temporal/isValidInstant.js +14 -0
  43. package/dist/temporal/isValidInstant.js.map +1 -0
  44. package/dist/temporal/isValidPlainDate.d.ts +5 -0
  45. package/dist/{utils → temporal}/isValidPlainDate.js +2 -2
  46. package/dist/temporal/isValidPlainDate.js.map +1 -0
  47. package/dist/temporal/isValidPlainDateTime.d.ts +5 -0
  48. package/dist/temporal/isValidPlainDateTime.js +14 -0
  49. package/dist/temporal/isValidPlainDateTime.js.map +1 -0
  50. package/dist/temporal/latestInstant.d.ts +9 -0
  51. package/dist/temporal/latestInstant.js +8 -0
  52. package/dist/temporal/latestInstant.js.map +1 -0
  53. package/dist/temporal/parseInstant.d.ts +5 -0
  54. package/dist/temporal/parseInstant.js +14 -0
  55. package/dist/temporal/parseInstant.js.map +1 -0
  56. package/dist/temporal/parsePlainDate.d.ts +5 -0
  57. package/dist/{utils → temporal}/parsePlainDate.js +2 -2
  58. package/dist/temporal/parsePlainDate.js.map +1 -0
  59. package/package.json +6 -3
  60. package/dist/utils/envCheck.js.map +0 -1
  61. package/dist/utils/isAfter.d.ts +0 -5
  62. package/dist/utils/isAfter.js +0 -7
  63. package/dist/utils/isAfter.js.map +0 -1
  64. package/dist/utils/isSamePlainDate.d.ts +0 -3
  65. package/dist/utils/isSamePlainDate.js +0 -13
  66. package/dist/utils/isSamePlainDate.js.map +0 -1
  67. package/dist/utils/isValidPlainDate.d.ts +0 -3
  68. package/dist/utils/isValidPlainDate.js.map +0 -1
  69. package/dist/utils/parsePlainDate.d.ts +0 -5
  70. package/dist/utils/parsePlainDate.js.map +0 -1
  71. /package/dist/{utils → temporal}/envCheck.d.ts +0 -0
  72. /package/dist/{utils → temporal}/envCheck.js +0 -0
package/dist/index.d.ts CHANGED
@@ -1,5 +1,20 @@
1
- export { default as isAfter } from './utils/isAfter.js';
2
- export { default as isSamePlainDate } from './utils/isSamePlainDate.js';
3
- export { default as isValidPlainDate } from './utils/isValidPlainDate.js';
4
- export { default as parsePlainDate } from './utils/parsePlainDate.js';
1
+ export { default as compareInstants } from './temporal/compareInstants.js';
2
+ export { default as comparePlainDates } from './temporal/comparePlainDates.js';
3
+ export { default as convertPlainDateToInstant } from './temporal/convertPlainDateToInstant.js';
4
+ export { default as envCheck } from './temporal/envCheck.js';
5
+ export { default as isInstantAfter } from './temporal/isInstantAfter.js';
6
+ export { default as isInstantBefore } from './temporal/isInstantBefore.js';
7
+ export { default as isPlainDateAfter } from './temporal/isPlainDateAfter.js';
8
+ export { default as isPlainDateBefore } from './temporal/isPlainDateBefore.js';
9
+ export { default as isSamePlainDate } from './temporal/isSamePlainDate.js';
10
+ export { default as isValidInstant } from './temporal/isValidInstant.js';
11
+ export { default as isValidPlainDate } from './temporal/isValidPlainDate.js';
12
+ export { default as isValidPlainDateTime } from './temporal/isValidPlainDateTime.js';
13
+ export { default as latestInstant } from './temporal/latestInstant.js';
14
+ export { default as MAX_INSTANT } from './temporal/MAX_INSTANT.js';
15
+ export { default as MAX_PLAIN_DATE } from './temporal/MAX_PLAIN_DATE.js';
16
+ export { default as MIN_INSTANT } from './temporal/MIN_INSTANT.js';
17
+ export { default as MIN_PLAIN_DATE } from './temporal/MIN_PLAIN_DATE.js';
18
+ export { default as parseInstant } from './temporal/parseInstant.js';
19
+ export { default as parsePlainDate } from './temporal/parsePlainDate.js';
5
20
  import 'temporal-polyfill';
package/dist/index.js CHANGED
@@ -1,11 +1,41 @@
1
- import { default as default2 } from "./utils/isAfter.js";
2
- import { default as default3 } from "./utils/isSamePlainDate.js";
3
- import { default as default4 } from "./utils/isValidPlainDate.js";
4
- import { default as default5 } from "./utils/parsePlainDate.js";
1
+ import { default as default2 } from "./temporal/compareInstants.js";
2
+ import { default as default3 } from "./temporal/comparePlainDates.js";
3
+ import { default as default4 } from "./temporal/convertPlainDateToInstant.js";
4
+ import { default as default5 } from "./temporal/envCheck.js";
5
+ import { default as default6 } from "./temporal/isInstantAfter.js";
6
+ import { default as default7 } from "./temporal/isInstantBefore.js";
7
+ import { default as default8 } from "./temporal/isPlainDateAfter.js";
8
+ import { default as default9 } from "./temporal/isPlainDateBefore.js";
9
+ import { default as default10 } from "./temporal/isSamePlainDate.js";
10
+ import { default as default11 } from "./temporal/isValidInstant.js";
11
+ import { default as default12 } from "./temporal/isValidPlainDate.js";
12
+ import { default as default13 } from "./temporal/isValidPlainDateTime.js";
13
+ import { default as default14 } from "./temporal/latestInstant.js";
14
+ import { default as default15 } from "./temporal/MAX_INSTANT.js";
15
+ import { default as default16 } from "./temporal/MAX_PLAIN_DATE.js";
16
+ import { default as default17 } from "./temporal/MIN_INSTANT.js";
17
+ import { default as default18 } from "./temporal/MIN_PLAIN_DATE.js";
18
+ import { default as default19 } from "./temporal/parseInstant.js";
19
+ import { default as default20 } from "./temporal/parsePlainDate.js";
5
20
  export {
6
- default2 as isAfter,
7
- default3 as isSamePlainDate,
8
- default4 as isValidPlainDate,
9
- default5 as parsePlainDate
21
+ default15 as MAX_INSTANT,
22
+ default16 as MAX_PLAIN_DATE,
23
+ default17 as MIN_INSTANT,
24
+ default18 as MIN_PLAIN_DATE,
25
+ default2 as compareInstants,
26
+ default3 as comparePlainDates,
27
+ default4 as convertPlainDateToInstant,
28
+ default5 as envCheck,
29
+ default6 as isInstantAfter,
30
+ default7 as isInstantBefore,
31
+ default8 as isPlainDateAfter,
32
+ default9 as isPlainDateBefore,
33
+ default10 as isSamePlainDate,
34
+ default11 as isValidInstant,
35
+ default12 as isValidPlainDate,
36
+ default13 as isValidPlainDateTime,
37
+ default14 as latestInstant,
38
+ default19 as parseInstant,
39
+ default20 as parsePlainDate
10
40
  };
11
41
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/index.ts"],"sourcesContent":["export { default as isAfter } from \"./utils/isAfter.js\";\nexport { default as isSamePlainDate } from \"./utils/isSamePlainDate.js\";\nexport { default as isValidPlainDate } from \"./utils/isValidPlainDate.js\";\nexport { default as parsePlainDate } from \"./utils/parsePlainDate.js\";\n"],"mappings":"AAAA,SAAoB,WAAXA,gBAA0B;AACnC,SAAoB,WAAXA,gBAAkC;AAC3C,SAAoB,WAAXA,gBAAmC;AAC5C,SAAoB,WAAXA,gBAAiC;","names":["default"]}
1
+ {"version":3,"sources":["../src/index.ts"],"sourcesContent":["export { default as compareInstants } from \"./temporal/compareInstants.js\";\nexport { default as comparePlainDates } from \"./temporal/comparePlainDates.js\";\nexport { default as convertPlainDateToInstant } from \"./temporal/convertPlainDateToInstant.js\";\nexport { default as envCheck } from \"./temporal/envCheck.js\";\nexport { default as isInstantAfter } from \"./temporal/isInstantAfter.js\";\nexport { default as isInstantBefore } from \"./temporal/isInstantBefore.js\";\nexport { default as isPlainDateAfter } from \"./temporal/isPlainDateAfter.js\";\nexport { default as isPlainDateBefore } from \"./temporal/isPlainDateBefore.js\";\nexport { default as isSamePlainDate } from \"./temporal/isSamePlainDate.js\";\nexport { default as isValidInstant } from \"./temporal/isValidInstant.js\";\nexport { default as isValidPlainDate } from \"./temporal/isValidPlainDate.js\";\nexport { default as isValidPlainDateTime } from \"./temporal/isValidPlainDateTime.js\";\nexport { default as latestInstant } from \"./temporal/latestInstant.js\";\nexport { default as MAX_INSTANT } from \"./temporal/MAX_INSTANT.js\";\nexport { default as MAX_PLAIN_DATE } from \"./temporal/MAX_PLAIN_DATE.js\";\nexport { default as MIN_INSTANT } from \"./temporal/MIN_INSTANT.js\";\nexport { default as MIN_PLAIN_DATE } from \"./temporal/MIN_PLAIN_DATE.js\";\nexport { default as parseInstant } from \"./temporal/parseInstant.js\";\nexport { default as parsePlainDate } from \"./temporal/parsePlainDate.js\";\n"],"mappings":"AAAA,SAAoB,WAAXA,gBAAkC;AAC3C,SAAoB,WAAXA,gBAAoC;AAC7C,SAAoB,WAAXA,gBAA4C;AACrD,SAAoB,WAAXA,gBAA2B;AACpC,SAAoB,WAAXA,gBAAiC;AAC1C,SAAoB,WAAXA,gBAAkC;AAC3C,SAAoB,WAAXA,gBAAmC;AAC5C,SAAoB,WAAXA,gBAAoC;AAC7C,SAAoB,WAAXA,iBAAkC;AAC3C,SAAoB,WAAXA,iBAAiC;AAC1C,SAAoB,WAAXA,iBAAmC;AAC5C,SAAoB,WAAXA,iBAAuC;AAChD,SAAoB,WAAXA,iBAAgC;AACzC,SAAoB,WAAXA,iBAA8B;AACvC,SAAoB,WAAXA,iBAAiC;AAC1C,SAAoB,WAAXA,iBAA8B;AACvC,SAAoB,WAAXA,iBAAiC;AAC1C,SAAoB,WAAXA,iBAA+B;AACxC,SAAoB,WAAXA,iBAAiC;","names":["default"]}
@@ -0,0 +1,5 @@
1
+ import { Temporal } from 'temporal-polyfill';
2
+
3
+ declare const MAX_INSTANT: Temporal.Instant;
4
+
5
+ export { MAX_INSTANT as default };
@@ -0,0 +1,7 @@
1
+ import { Temporal } from "temporal-polyfill";
2
+ const MAX_INSTANT = Temporal.Instant.fromEpochMilliseconds(Math.pow(10, 8) * 24 * 60 * 60 * 1e3);
3
+ var MAX_INSTANT_default = MAX_INSTANT;
4
+ export {
5
+ MAX_INSTANT_default as default
6
+ };
7
+ //# sourceMappingURL=MAX_INSTANT.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/temporal/MAX_INSTANT.ts"],"sourcesContent":["import { Temporal } from \"temporal-polyfill\";\n\nconst MAX_INSTANT = Temporal.Instant.fromEpochMilliseconds(Math.pow(10, 8) * 24 * 60 * 60 * 1000);\n\nexport default MAX_INSTANT;\n"],"mappings":"AAAA,SAAS,gBAAgB;AAEzB,MAAM,cAAc,SAAS,QAAQ,sBAAsB,KAAK,IAAI,IAAI,CAAC,IAAI,KAAK,KAAK,KAAK,GAAI;AAEhG,IAAO,sBAAQ;","names":[]}
@@ -0,0 +1,5 @@
1
+ import * as temporal_polyfill from 'temporal-polyfill';
2
+
3
+ declare const MAX_PLAIN_DATE: temporal_polyfill.Temporal.PlainDate;
4
+
5
+ export { MAX_PLAIN_DATE as default };
@@ -0,0 +1,7 @@
1
+ import MAX_INSTANT from "./MAX_INSTANT.js";
2
+ const MAX_PLAIN_DATE = MAX_INSTANT.toZonedDateTimeISO("UTC").toPlainDate();
3
+ var MAX_PLAIN_DATE_default = MAX_PLAIN_DATE;
4
+ export {
5
+ MAX_PLAIN_DATE_default as default
6
+ };
7
+ //# sourceMappingURL=MAX_PLAIN_DATE.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/temporal/MAX_PLAIN_DATE.ts"],"sourcesContent":["import MAX_INSTANT from \"./MAX_INSTANT.js\";\n\nconst MAX_PLAIN_DATE = MAX_INSTANT.toZonedDateTimeISO(\"UTC\").toPlainDate();\n\nexport default MAX_PLAIN_DATE;\n"],"mappings":"AAAA,OAAO,iBAAiB;AAExB,MAAM,iBAAiB,YAAY,mBAAmB,KAAK,EAAE,YAAY;AAEzE,IAAO,yBAAQ;","names":[]}
@@ -0,0 +1,5 @@
1
+ import { Temporal } from 'temporal-polyfill';
2
+
3
+ declare const MIN_INSTANT: Temporal.Instant;
4
+
5
+ export { MIN_INSTANT as default };
@@ -0,0 +1,7 @@
1
+ import { Temporal } from "temporal-polyfill";
2
+ const MIN_INSTANT = Temporal.Instant.fromEpochMilliseconds(-Math.pow(10, 8) * 24 * 60 * 60 * 1e3);
3
+ var MIN_INSTANT_default = MIN_INSTANT;
4
+ export {
5
+ MIN_INSTANT_default as default
6
+ };
7
+ //# sourceMappingURL=MIN_INSTANT.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/temporal/MIN_INSTANT.ts"],"sourcesContent":["import { Temporal } from \"temporal-polyfill\";\n\nconst MIN_INSTANT = Temporal.Instant.fromEpochMilliseconds(-Math.pow(10, 8) * 24 * 60 * 60 * 1000);\n\nexport default MIN_INSTANT;\n"],"mappings":"AAAA,SAAS,gBAAgB;AAEzB,MAAM,cAAc,SAAS,QAAQ,sBAAsB,CAAC,KAAK,IAAI,IAAI,CAAC,IAAI,KAAK,KAAK,KAAK,GAAI;AAEjG,IAAO,sBAAQ;","names":[]}
@@ -0,0 +1,5 @@
1
+ import * as temporal_polyfill from 'temporal-polyfill';
2
+
3
+ declare const MIN_PLAIN_DATE: temporal_polyfill.Temporal.PlainDate;
4
+
5
+ export { MIN_PLAIN_DATE as default };
@@ -0,0 +1,7 @@
1
+ import MIN_INSTANT from "./MIN_INSTANT.js";
2
+ const MIN_PLAIN_DATE = MIN_INSTANT.toZonedDateTimeISO("UTC").toPlainDate();
3
+ var MIN_PLAIN_DATE_default = MIN_PLAIN_DATE;
4
+ export {
5
+ MIN_PLAIN_DATE_default as default
6
+ };
7
+ //# sourceMappingURL=MIN_PLAIN_DATE.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/temporal/MIN_PLAIN_DATE.ts"],"sourcesContent":["import MIN_INSTANT from \"./MIN_INSTANT.js\";\n\nconst MIN_PLAIN_DATE = MIN_INSTANT.toZonedDateTimeISO(\"UTC\").toPlainDate();\n\nexport default MIN_PLAIN_DATE;\n"],"mappings":"AAAA,OAAO,iBAAiB;AAExB,MAAM,iBAAiB,YAAY,mBAAmB,KAAK,EAAE,YAAY;AAEzE,IAAO,yBAAQ;","names":[]}
@@ -0,0 +1,11 @@
1
+ import { Temporal } from 'temporal-polyfill';
2
+
3
+ /**
4
+ * Default direction is ascending with nulls first.
5
+ */
6
+ declare const compareInstants: (a: Temporal.Instant | null, b: Temporal.Instant | null, options?: {
7
+ direction?: "asc" | "desc";
8
+ nullsFirst?: boolean;
9
+ }) => number;
10
+
11
+ export { compareInstants as default };
@@ -0,0 +1,15 @@
1
+ import { Temporal } from "temporal-polyfill";
2
+ import MAX_INSTANT from "./MAX_INSTANT.js";
3
+ import MIN_INSTANT from "./MIN_INSTANT.js";
4
+ const compareInstants = (a, b, options) => {
5
+ const nullsFirst = options?.nullsFirst ?? true;
6
+ const direction = options?.direction ?? "asc";
7
+ const instantA = a ?? (nullsFirst ? MAX_INSTANT : MIN_INSTANT);
8
+ const instantB = b ?? (nullsFirst ? MAX_INSTANT : MIN_INSTANT);
9
+ return Temporal.Instant.compare(instantA, instantB) * (direction === "asc" ? 1 : -1);
10
+ };
11
+ var compareInstants_default = compareInstants;
12
+ export {
13
+ compareInstants_default as default
14
+ };
15
+ //# sourceMappingURL=compareInstants.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/temporal/compareInstants.ts"],"sourcesContent":["import { Temporal } from \"temporal-polyfill\";\nimport MAX_INSTANT from \"./MAX_INSTANT.js\";\nimport MIN_INSTANT from \"./MIN_INSTANT.js\";\n\n/**\n * Default direction is ascending with nulls first.\n */\nconst compareInstants = (\n a: Temporal.Instant | null,\n b: Temporal.Instant | null,\n options?: {\n direction?: \"asc\" | \"desc\";\n nullsFirst?: boolean;\n },\n) => {\n const nullsFirst = options?.nullsFirst ?? true;\n const direction = options?.direction ?? \"asc\";\n const instantA = a ?? (nullsFirst ? MAX_INSTANT : MIN_INSTANT);\n const instantB = b ?? (nullsFirst ? MAX_INSTANT : MIN_INSTANT);\n return Temporal.Instant.compare(instantA, instantB) * (direction === \"asc\" ? 1 : -1);\n};\n\nexport default compareInstants;\n"],"mappings":"AAAA,SAAS,gBAAgB;AACzB,OAAO,iBAAiB;AACxB,OAAO,iBAAiB;AAKxB,MAAM,kBAAkB,CACtB,GACA,GACA,YAIG;AACH,QAAM,aAAa,SAAS,cAAc;AAC1C,QAAM,YAAY,SAAS,aAAa;AACxC,QAAM,WAAW,MAAM,aAAa,cAAc;AAClD,QAAM,WAAW,MAAM,aAAa,cAAc;AAClD,SAAO,SAAS,QAAQ,QAAQ,UAAU,QAAQ,KAAK,cAAc,QAAQ,IAAI;AACnF;AAEA,IAAO,0BAAQ;","names":[]}
@@ -0,0 +1,11 @@
1
+ import { Temporal } from 'temporal-polyfill';
2
+
3
+ /**
4
+ * Default direction is ascending with nulls first.
5
+ */
6
+ declare const comparePlainDates: (a: Temporal.PlainDate | null, b: Temporal.PlainDate | null, options?: {
7
+ direction?: "asc" | "desc";
8
+ nullsFirst?: boolean;
9
+ }) => number;
10
+
11
+ export { comparePlainDates as default };
@@ -0,0 +1,15 @@
1
+ import { Temporal } from "temporal-polyfill";
2
+ import MAX_PLAIN_DATE from "./MAX_PLAIN_DATE.js";
3
+ import MIN_PLAIN_DATE from "./MIN_PLAIN_DATE.js";
4
+ const comparePlainDates = (a, b, options) => {
5
+ const nullsFirst = options?.nullsFirst ?? true;
6
+ const direction = options?.direction ?? "asc";
7
+ const dateA = a ?? (nullsFirst ? MAX_PLAIN_DATE : MIN_PLAIN_DATE);
8
+ const dateB = b ?? (nullsFirst ? MAX_PLAIN_DATE : MIN_PLAIN_DATE);
9
+ return Temporal.PlainDate.compare(dateA, dateB) * (direction === "asc" ? 1 : -1);
10
+ };
11
+ var comparePlainDates_default = comparePlainDates;
12
+ export {
13
+ comparePlainDates_default as default
14
+ };
15
+ //# sourceMappingURL=comparePlainDates.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/temporal/comparePlainDates.ts"],"sourcesContent":["import { Temporal } from \"temporal-polyfill\";\nimport MAX_PLAIN_DATE from \"./MAX_PLAIN_DATE.js\";\nimport MIN_PLAIN_DATE from \"./MIN_PLAIN_DATE.js\";\n\n/**\n * Default direction is ascending with nulls first.\n */\nconst comparePlainDates = (\n a: Temporal.PlainDate | null,\n b: Temporal.PlainDate | null,\n options?: {\n direction?: \"asc\" | \"desc\";\n nullsFirst?: boolean;\n },\n) => {\n const nullsFirst = options?.nullsFirst ?? true;\n const direction = options?.direction ?? \"asc\";\n const dateA = a ?? (nullsFirst ? MAX_PLAIN_DATE : MIN_PLAIN_DATE);\n const dateB = b ?? (nullsFirst ? MAX_PLAIN_DATE : MIN_PLAIN_DATE);\n return Temporal.PlainDate.compare(dateA, dateB) * (direction === \"asc\" ? 1 : -1);\n};\n\nexport default comparePlainDates;\n"],"mappings":"AAAA,SAAS,gBAAgB;AACzB,OAAO,oBAAoB;AAC3B,OAAO,oBAAoB;AAK3B,MAAM,oBAAoB,CACxB,GACA,GACA,YAIG;AACH,QAAM,aAAa,SAAS,cAAc;AAC1C,QAAM,YAAY,SAAS,aAAa;AACxC,QAAM,QAAQ,MAAM,aAAa,iBAAiB;AAClD,QAAM,QAAQ,MAAM,aAAa,iBAAiB;AAClD,SAAO,SAAS,UAAU,QAAQ,OAAO,KAAK,KAAK,cAAc,QAAQ,IAAI;AAC/E;AAEA,IAAO,4BAAQ;","names":[]}
@@ -0,0 +1,5 @@
1
+ import { Temporal } from 'temporal-polyfill';
2
+
3
+ declare const convertPlainDateToInstant: (plainDate: Temporal.PlainDate | null, timeZone: string) => Temporal.Instant | null;
4
+
5
+ export { convertPlainDateToInstant as default };
@@ -0,0 +1,6 @@
1
+ const convertPlainDateToInstant = (plainDate, timeZone) => plainDate ? plainDate.toZonedDateTime({ timeZone }).toInstant() : null;
2
+ var convertPlainDateToInstant_default = convertPlainDateToInstant;
3
+ export {
4
+ convertPlainDateToInstant_default as default
5
+ };
6
+ //# sourceMappingURL=convertPlainDateToInstant.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/temporal/convertPlainDateToInstant.ts"],"sourcesContent":["import type { Temporal } from \"temporal-polyfill\";\n\nconst convertPlainDateToInstant = (\n plainDate: Temporal.PlainDate | null,\n timeZone: string,\n): Temporal.Instant | null =>\n plainDate ? plainDate.toZonedDateTime({ timeZone }).toInstant() : null;\n\nexport default convertPlainDateToInstant;\n"],"mappings":"AAEA,MAAM,4BAA4B,CAChC,WACA,aAEA,YAAY,UAAU,gBAAgB,EAAE,SAAS,CAAC,EAAE,UAAU,IAAI;AAEpE,IAAO,oCAAQ;","names":[]}
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/temporal/envCheck.ts"],"sourcesContent":["function envCheck(value: string | undefined, name: string): asserts value is string {\n if (value === undefined) {\n throw Error(`Missing \\`${name}\\` environment variable.`);\n }\n}\n\nexport default envCheck;\n"],"mappings":"AAAA,SAAS,SAAS,OAA2B,MAAuC;AAClF,MAAI,UAAU,QAAW;AACvB,UAAM,MAAM,aAAa,IAAI,0BAA0B;AAAA,EACzD;AACF;AAEA,IAAO,mBAAQ;","names":[]}
@@ -0,0 +1,7 @@
1
+ import { Temporal } from 'temporal-polyfill';
2
+
3
+ declare const isInstantAfter: (a: Temporal.Instant | null, b: Temporal.Instant | null, options?: {
4
+ nullsFirst?: boolean;
5
+ }) => boolean;
6
+
7
+ export { isInstantAfter as default };
@@ -0,0 +1,8 @@
1
+ import { Temporal } from "temporal-polyfill";
2
+ import compareInstants from "./compareInstants.js";
3
+ const isInstantAfter = (a, b, options) => compareInstants(a, b, { direction: "asc", nullsFirst: options?.nullsFirst }) === 1;
4
+ var isInstantAfter_default = isInstantAfter;
5
+ export {
6
+ isInstantAfter_default as default
7
+ };
8
+ //# sourceMappingURL=isInstantAfter.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/temporal/isInstantAfter.ts"],"sourcesContent":["import { Temporal } from \"temporal-polyfill\";\nimport compareInstants from \"./compareInstants.js\";\n\nconst isInstantAfter = (\n a: Temporal.Instant | null,\n b: Temporal.Instant | null,\n options?: {\n nullsFirst?: boolean;\n },\n) => compareInstants(a, b, { direction: \"asc\", nullsFirst: options?.nullsFirst }) === 1;\n\nexport default isInstantAfter;\n"],"mappings":"AAAA,SAAS,gBAAgB;AACzB,OAAO,qBAAqB;AAE5B,MAAM,iBAAiB,CACrB,GACA,GACA,YAGG,gBAAgB,GAAG,GAAG,EAAE,WAAW,OAAO,YAAY,SAAS,WAAW,CAAC,MAAM;AAEtF,IAAO,yBAAQ;","names":[]}
@@ -0,0 +1,7 @@
1
+ import { Temporal } from 'temporal-polyfill';
2
+
3
+ declare const isInstantBefore: (a: Temporal.Instant | null, b: Temporal.Instant | null, options?: {
4
+ nullsFirst?: boolean;
5
+ }) => boolean;
6
+
7
+ export { isInstantBefore as default };
@@ -0,0 +1,8 @@
1
+ import { Temporal } from "temporal-polyfill";
2
+ import compareInstants from "./compareInstants.js";
3
+ const isInstantBefore = (a, b, options) => compareInstants(a, b, { direction: "desc", nullsFirst: options?.nullsFirst }) === 1;
4
+ var isInstantBefore_default = isInstantBefore;
5
+ export {
6
+ isInstantBefore_default as default
7
+ };
8
+ //# sourceMappingURL=isInstantBefore.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/temporal/isInstantBefore.ts"],"sourcesContent":["import { Temporal } from \"temporal-polyfill\";\nimport compareInstants from \"./compareInstants.js\";\n\nconst isInstantBefore = (\n a: Temporal.Instant | null,\n b: Temporal.Instant | null,\n options?: {\n nullsFirst?: boolean;\n },\n) => compareInstants(a, b, { direction: \"desc\", nullsFirst: options?.nullsFirst }) === 1;\n\nexport default isInstantBefore;\n"],"mappings":"AAAA,SAAS,gBAAgB;AACzB,OAAO,qBAAqB;AAE5B,MAAM,kBAAkB,CACtB,GACA,GACA,YAGG,gBAAgB,GAAG,GAAG,EAAE,WAAW,QAAQ,YAAY,SAAS,WAAW,CAAC,MAAM;AAEvF,IAAO,0BAAQ;","names":[]}
@@ -0,0 +1,7 @@
1
+ import { Temporal } from 'temporal-polyfill';
2
+
3
+ declare const isPlainDateAfter: (a: Temporal.PlainDate | null, b: Temporal.PlainDate | null, options?: {
4
+ nullsFirst?: boolean;
5
+ }) => boolean;
6
+
7
+ export { isPlainDateAfter as default };
@@ -0,0 +1,8 @@
1
+ import { Temporal } from "temporal-polyfill";
2
+ import comparePlainDates from "./comparePlainDates.js";
3
+ const isPlainDateAfter = (a, b, options) => comparePlainDates(a, b, { direction: "asc", nullsFirst: options?.nullsFirst }) === 1;
4
+ var isPlainDateAfter_default = isPlainDateAfter;
5
+ export {
6
+ isPlainDateAfter_default as default
7
+ };
8
+ //# sourceMappingURL=isPlainDateAfter.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/temporal/isPlainDateAfter.ts"],"sourcesContent":["import { Temporal } from \"temporal-polyfill\";\nimport comparePlainDates from \"./comparePlainDates.js\";\n\nconst isPlainDateAfter = (\n a: Temporal.PlainDate | null,\n b: Temporal.PlainDate | null,\n options?: {\n nullsFirst?: boolean;\n },\n) => comparePlainDates(a, b, { direction: \"asc\", nullsFirst: options?.nullsFirst }) === 1;\n\nexport default isPlainDateAfter;\n"],"mappings":"AAAA,SAAS,gBAAgB;AACzB,OAAO,uBAAuB;AAE9B,MAAM,mBAAmB,CACvB,GACA,GACA,YAGG,kBAAkB,GAAG,GAAG,EAAE,WAAW,OAAO,YAAY,SAAS,WAAW,CAAC,MAAM;AAExF,IAAO,2BAAQ;","names":[]}
@@ -0,0 +1,7 @@
1
+ import { Temporal } from 'temporal-polyfill';
2
+
3
+ declare const isPlainDateBefore: (a: Temporal.PlainDate | null, b: Temporal.PlainDate | null, options?: {
4
+ nullsFirst?: boolean;
5
+ }) => boolean;
6
+
7
+ export { isPlainDateBefore as default };
@@ -0,0 +1,8 @@
1
+ import { Temporal } from "temporal-polyfill";
2
+ import comparePlainDates from "./comparePlainDates.js";
3
+ const isPlainDateBefore = (a, b, options) => comparePlainDates(a, b, { direction: "desc", nullsFirst: options?.nullsFirst }) === 1;
4
+ var isPlainDateBefore_default = isPlainDateBefore;
5
+ export {
6
+ isPlainDateBefore_default as default
7
+ };
8
+ //# sourceMappingURL=isPlainDateBefore.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/temporal/isPlainDateBefore.ts"],"sourcesContent":["import { Temporal } from \"temporal-polyfill\";\nimport comparePlainDates from \"./comparePlainDates.js\";\n\nconst isPlainDateBefore = (\n a: Temporal.PlainDate | null,\n b: Temporal.PlainDate | null,\n options?: {\n nullsFirst?: boolean;\n },\n) => comparePlainDates(a, b, { direction: \"desc\", nullsFirst: options?.nullsFirst }) === 1;\n\nexport default isPlainDateBefore;\n"],"mappings":"AAAA,SAAS,gBAAgB;AACzB,OAAO,uBAAuB;AAE9B,MAAM,oBAAoB,CACxB,GACA,GACA,YAGG,kBAAkB,GAAG,GAAG,EAAE,WAAW,QAAQ,YAAY,SAAS,WAAW,CAAC,MAAM;AAEzF,IAAO,4BAAQ;","names":[]}
@@ -0,0 +1,9 @@
1
+ import { Temporal } from 'temporal-polyfill';
2
+
3
+ /**
4
+ * Returns true if a and b are both valid plain dates and represent the same
5
+ * date. Returns false if either date is null.
6
+ */
7
+ declare const isSamePlainDate: (a: Temporal.PlainDate | null, b: Temporal.PlainDate | null) => boolean;
8
+
9
+ export { isSamePlainDate as default };
@@ -0,0 +1,9 @@
1
+ const isSamePlainDate = (a, b) => {
2
+ if (a === null || b === null) return false;
3
+ return a.equals(b);
4
+ };
5
+ var isSamePlainDate_default = isSamePlainDate;
6
+ export {
7
+ isSamePlainDate_default as default
8
+ };
9
+ //# sourceMappingURL=isSamePlainDate.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/temporal/isSamePlainDate.ts"],"sourcesContent":["import type { Temporal } from \"temporal-polyfill\";\n\n/**\n * Returns true if a and b are both valid plain dates and represent the same\n * date. Returns false if either date is null.\n */\nconst isSamePlainDate = (a: Temporal.PlainDate | null, b: Temporal.PlainDate | null): boolean => {\n if (a === null || b === null) return false;\n return a.equals(b);\n};\n\nexport default isSamePlainDate;\n"],"mappings":"AAMA,MAAM,kBAAkB,CAAC,GAA8B,MAA0C;AAC/F,MAAI,MAAM,QAAQ,MAAM,KAAM,QAAO;AACrC,SAAO,EAAE,OAAO,CAAC;AACnB;AAEA,IAAO,0BAAQ;","names":[]}
@@ -0,0 +1,5 @@
1
+ import { Temporal } from 'temporal-polyfill';
2
+
3
+ declare const isValidInstant: (instant: Temporal.Instant | string | null | undefined) => instant is string;
4
+
5
+ export { isValidInstant as default };
@@ -0,0 +1,14 @@
1
+ import { Temporal } from "temporal-polyfill";
2
+ const isValidInstant = (instant) => {
3
+ if (instant === null || instant === void 0) return false;
4
+ try {
5
+ return Boolean(Temporal.Instant.from(instant));
6
+ } catch {
7
+ return false;
8
+ }
9
+ };
10
+ var isValidInstant_default = isValidInstant;
11
+ export {
12
+ isValidInstant_default as default
13
+ };
14
+ //# sourceMappingURL=isValidInstant.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/temporal/isValidInstant.ts"],"sourcesContent":["import { Temporal } from \"temporal-polyfill\";\n\nconst isValidInstant = (\n instant: Temporal.Instant | string | null | undefined,\n): instant is string => {\n if (instant === null || instant === undefined) return false;\n try {\n return Boolean(Temporal.Instant.from(instant));\n } catch {\n return false;\n }\n};\n\nexport default isValidInstant;\n"],"mappings":"AAAA,SAAS,gBAAgB;AAEzB,MAAM,iBAAiB,CACrB,YACsB;AACtB,MAAI,YAAY,QAAQ,YAAY,OAAW,QAAO;AACtD,MAAI;AACF,WAAO,QAAQ,SAAS,QAAQ,KAAK,OAAO,CAAC;AAAA,EAC/C,QAAQ;AACN,WAAO;AAAA,EACT;AACF;AAEA,IAAO,yBAAQ;","names":[]}
@@ -0,0 +1,5 @@
1
+ import { Temporal } from 'temporal-polyfill';
2
+
3
+ declare const isValidPlainDate: (date: Temporal.PlainDate | string | null | undefined, options?: Temporal.AssignmentOptions) => date is string;
4
+
5
+ export { isValidPlainDate as default };
@@ -1,8 +1,8 @@
1
1
  import { Temporal } from "temporal-polyfill";
2
- const isValidPlainDate = (date) => {
2
+ const isValidPlainDate = (date, options) => {
3
3
  if (date === null || date === void 0) return false;
4
4
  try {
5
- return date === Temporal.PlainDate.from(date).toString();
5
+ return Boolean(Temporal.PlainDate.from(date, options));
6
6
  } catch {
7
7
  return false;
8
8
  }
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/temporal/isValidPlainDate.ts"],"sourcesContent":["import { Temporal } from \"temporal-polyfill\";\n\nconst isValidPlainDate = (\n date: Temporal.PlainDate | string | null | undefined,\n options?: Temporal.AssignmentOptions,\n): date is string => {\n if (date === null || date === undefined) return false;\n try {\n return Boolean(Temporal.PlainDate.from(date, options));\n } catch {\n return false;\n }\n};\n\nexport default isValidPlainDate;\n"],"mappings":"AAAA,SAAS,gBAAgB;AAEzB,MAAM,mBAAmB,CACvB,MACA,YACmB;AACnB,MAAI,SAAS,QAAQ,SAAS,OAAW,QAAO;AAChD,MAAI;AACF,WAAO,QAAQ,SAAS,UAAU,KAAK,MAAM,OAAO,CAAC;AAAA,EACvD,QAAQ;AACN,WAAO;AAAA,EACT;AACF;AAEA,IAAO,2BAAQ;","names":[]}
@@ -0,0 +1,5 @@
1
+ import { Temporal } from 'temporal-polyfill';
2
+
3
+ declare const isValidPlainDateTime: (dateTime: Temporal.PlainDateTime | string | null | undefined) => dateTime is string;
4
+
5
+ export { isValidPlainDateTime as default };
@@ -0,0 +1,14 @@
1
+ import { Temporal } from "temporal-polyfill";
2
+ const isValidPlainDateTime = (dateTime) => {
3
+ if (dateTime === null || dateTime === void 0) return false;
4
+ try {
5
+ return Boolean(Temporal.PlainDateTime.from(dateTime));
6
+ } catch {
7
+ return false;
8
+ }
9
+ };
10
+ var isValidPlainDateTime_default = isValidPlainDateTime;
11
+ export {
12
+ isValidPlainDateTime_default as default
13
+ };
14
+ //# sourceMappingURL=isValidPlainDateTime.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/temporal/isValidPlainDateTime.ts"],"sourcesContent":["import { Temporal } from \"temporal-polyfill\";\n\nconst isValidPlainDateTime = (\n dateTime: Temporal.PlainDateTime | string | null | undefined,\n): dateTime is string => {\n if (dateTime === null || dateTime === undefined) return false;\n try {\n return Boolean(Temporal.PlainDateTime.from(dateTime));\n } catch {\n return false;\n }\n};\n\nexport default isValidPlainDateTime;\n"],"mappings":"AAAA,SAAS,gBAAgB;AAEzB,MAAM,uBAAuB,CAC3B,aACuB;AACvB,MAAI,aAAa,QAAQ,aAAa,OAAW,QAAO;AACxD,MAAI;AACF,WAAO,QAAQ,SAAS,cAAc,KAAK,QAAQ,CAAC;AAAA,EACtD,QAAQ;AACN,WAAO;AAAA,EACT;AACF;AAEA,IAAO,+BAAQ;","names":[]}
@@ -0,0 +1,9 @@
1
+ import { Temporal } from 'temporal-polyfill';
2
+
3
+ /**
4
+ * Returns the latest instant from an array of instants (ignoring nulls). if the
5
+ * array is empty or contains only nulls, returns null.
6
+ */
7
+ declare const latestInstant: (instants: Array<Temporal.Instant | null>) => Temporal.Instant | null;
8
+
9
+ export { latestInstant as default };
@@ -0,0 +1,8 @@
1
+ import { Temporal } from "temporal-polyfill";
2
+ import compareInstants from "./compareInstants.js";
3
+ const latestInstant = (instants) => [...instants].sort((a, b) => compareInstants(a, b, { direction: "desc", nullsFirst: false })).at(0) ?? null;
4
+ var latestInstant_default = latestInstant;
5
+ export {
6
+ latestInstant_default as default
7
+ };
8
+ //# sourceMappingURL=latestInstant.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/temporal/latestInstant.ts"],"sourcesContent":["import { Temporal } from \"temporal-polyfill\";\nimport compareInstants from \"./compareInstants.js\";\n\n/**\n * Returns the latest instant from an array of instants (ignoring nulls). if the\n * array is empty or contains only nulls, returns null.\n */\nconst latestInstant = (instants: Array<Temporal.Instant | null>) =>\n [...instants]\n .sort((a, b) => compareInstants(a, b, { direction: \"desc\", nullsFirst: false }))\n .at(0) ?? null;\n\nexport default latestInstant;\n"],"mappings":"AAAA,SAAS,gBAAgB;AACzB,OAAO,qBAAqB;AAM5B,MAAM,gBAAgB,CAAC,aACrB,CAAC,GAAG,QAAQ,EACT,KAAK,CAAC,GAAG,MAAM,gBAAgB,GAAG,GAAG,EAAE,WAAW,QAAQ,YAAY,MAAM,CAAC,CAAC,EAC9E,GAAG,CAAC,KAAK;AAEd,IAAO,wBAAQ;","names":[]}
@@ -0,0 +1,5 @@
1
+ import { Temporal } from 'temporal-polyfill';
2
+
3
+ declare const parseInstant: (date: Temporal.Instant | string | null | undefined) => Temporal.Instant | null;
4
+
5
+ export { parseInstant as default };
@@ -0,0 +1,14 @@
1
+ import { Temporal } from "temporal-polyfill";
2
+ const parseInstant = (date) => {
3
+ if (date === null || date === void 0) return null;
4
+ try {
5
+ return Temporal.Instant.from(date);
6
+ } catch {
7
+ return null;
8
+ }
9
+ };
10
+ var parseInstant_default = parseInstant;
11
+ export {
12
+ parseInstant_default as default
13
+ };
14
+ //# sourceMappingURL=parseInstant.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/temporal/parseInstant.ts"],"sourcesContent":["import { Temporal } from \"temporal-polyfill\";\n\nconst parseInstant = (\n date: Temporal.Instant | string | null | undefined,\n): Temporal.Instant | null => {\n if (date === null || date === undefined) return null;\n try {\n return Temporal.Instant.from(date);\n } catch {\n return null;\n }\n};\n\nexport default parseInstant;\n"],"mappings":"AAAA,SAAS,gBAAgB;AAEzB,MAAM,eAAe,CACnB,SAC4B;AAC5B,MAAI,SAAS,QAAQ,SAAS,OAAW,QAAO;AAChD,MAAI;AACF,WAAO,SAAS,QAAQ,KAAK,IAAI;AAAA,EACnC,QAAQ;AACN,WAAO;AAAA,EACT;AACF;AAEA,IAAO,uBAAQ;","names":[]}
@@ -0,0 +1,5 @@
1
+ import { Temporal } from 'temporal-polyfill';
2
+
3
+ declare const parsePlainDate: (date: Temporal.PlainDate | string | null | undefined, options?: Temporal.AssignmentOptions) => Temporal.PlainDate | null;
4
+
5
+ export { parsePlainDate as default };
@@ -1,8 +1,8 @@
1
1
  import { Temporal } from "temporal-polyfill";
2
- const parsePlainDate = (date) => {
2
+ const parsePlainDate = (date, options) => {
3
3
  if (date === null || date === void 0) return null;
4
4
  try {
5
- return Temporal.PlainDate.from(date);
5
+ return Temporal.PlainDate.from(date, options);
6
6
  } catch {
7
7
  return null;
8
8
  }
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/temporal/parsePlainDate.ts"],"sourcesContent":["import { Temporal } from \"temporal-polyfill\";\n\nconst parsePlainDate = (\n date: Temporal.PlainDate | string | null | undefined,\n options?: Temporal.AssignmentOptions,\n): Temporal.PlainDate | null => {\n if (date === null || date === undefined) return null;\n try {\n return Temporal.PlainDate.from(date, options);\n } catch {\n return null;\n }\n};\n\nexport default parsePlainDate;\n"],"mappings":"AAAA,SAAS,gBAAgB;AAEzB,MAAM,iBAAiB,CACrB,MACA,YAC8B;AAC9B,MAAI,SAAS,QAAQ,SAAS,OAAW,QAAO;AAChD,MAAI;AACF,WAAO,SAAS,UAAU,KAAK,MAAM,OAAO;AAAA,EAC9C,QAAQ;AACN,WAAO;AAAA,EACT;AACF;AAEA,IAAO,yBAAQ;","names":[]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@worknice/utils",
3
- "version": "0.0.3",
3
+ "version": "0.0.4",
4
4
  "license": "MIT",
5
5
  "private": false,
6
6
  "type": "module",
@@ -28,9 +28,10 @@
28
28
  "@typescript-eslint/eslint-plugin": "^8.7.0",
29
29
  "@typescript-eslint/parser": "^8.7.0",
30
30
  "eslint": "^8.57.1",
31
- "temporal-polyfill": "^0.2.1",
31
+ "temporal-polyfill": "^0.2.5",
32
32
  "tsup": "^8.2.4",
33
- "typescript": "~5.5.0"
33
+ "typescript": "~5.5.0",
34
+ "vitest": "^2.1.8"
34
35
  },
35
36
  "peerDependencies": {
36
37
  "temporal-polyfill": "^0.2.1"
@@ -38,8 +39,10 @@
38
39
  "scripts": {
39
40
  "build": "rm -rf ./dist && tsup",
40
41
  "dev": "rm -rf ./dist && tsup --watch",
42
+ "dev:test": "vitest",
41
43
  "release": "pnpm build && pnpm dlx @jsdevtools/version-bump-prompt --commit \"chore(utils): release v%s\" --tag \"utils-v%s\" && pnpm publish --access public",
42
44
  "test": "if [[ -z $TURBO_HASH ]]; then echo 'Use `pnpm turbo test` to run tests.\n' && exit 1; else exit 0; fi",
45
+ "test:unit": "vitest run",
43
46
  "test:lint": "eslint src --color",
44
47
  "test:prettier": "prettier -c '**/*.{js,ts,tsx,css}'",
45
48
  "test:types": "tsc --noEmit --pretty"
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/utils/envCheck.ts"],"sourcesContent":["function envCheck(value: string | undefined, name: string): asserts value is string {\n if (value === undefined) {\n throw Error(`Missing \\`${name}\\` environment variable.`);\n }\n}\n\nexport default envCheck;\n"],"mappings":"AAAA,SAAS,SAAS,OAA2B,MAAuC;AAClF,MAAI,UAAU,QAAW;AACvB,UAAM,MAAM,aAAa,IAAI,0BAA0B;AAAA,EACzD;AACF;AAEA,IAAO,mBAAQ;","names":[]}
@@ -1,5 +0,0 @@
1
- import { Temporal } from 'temporal-polyfill';
2
-
3
- declare const isAfter: (a: Temporal.Instant, b: Temporal.Instant) => boolean;
4
-
5
- export { isAfter as default };
@@ -1,7 +0,0 @@
1
- import { Temporal } from "temporal-polyfill";
2
- const isAfter = (a, b) => Temporal.Instant.compare(a, b) === 1;
3
- var isAfter_default = isAfter;
4
- export {
5
- isAfter_default as default
6
- };
7
- //# sourceMappingURL=isAfter.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/utils/isAfter.ts"],"sourcesContent":["import { Temporal } from \"temporal-polyfill\";\n\nconst isAfter = (a: Temporal.Instant, b: Temporal.Instant) => Temporal.Instant.compare(a, b) === 1;\n\nexport default isAfter;\n"],"mappings":"AAAA,SAAS,gBAAgB;AAEzB,MAAM,UAAU,CAAC,GAAqB,MAAwB,SAAS,QAAQ,QAAQ,GAAG,CAAC,MAAM;AAEjG,IAAO,kBAAQ;","names":[]}
@@ -1,3 +0,0 @@
1
- declare const isSamePlainDate: (a: string | null | undefined, b: string | null | undefined) => boolean;
2
-
3
- export { isSamePlainDate as default };
@@ -1,13 +0,0 @@
1
- import parsePlainDate from "./parsePlainDate.js";
2
- const isSamePlainDate = (a, b) => {
3
- const dateA = parsePlainDate(a);
4
- const dateB = parsePlainDate(b);
5
- if (dateA === null && dateB === null) return true;
6
- if (dateA === null || dateB === null) return false;
7
- return dateA.equals(dateB);
8
- };
9
- var isSamePlainDate_default = isSamePlainDate;
10
- export {
11
- isSamePlainDate_default as default
12
- };
13
- //# sourceMappingURL=isSamePlainDate.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/utils/isSamePlainDate.ts"],"sourcesContent":["import parsePlainDate from \"./parsePlainDate.js\";\n\nconst isSamePlainDate = (a: string | null | undefined, b: string | null | undefined): boolean => {\n const dateA = parsePlainDate(a);\n const dateB = parsePlainDate(b);\n if (dateA === null && dateB === null) return true;\n if (dateA === null || dateB === null) return false;\n return dateA.equals(dateB);\n};\n\nexport default isSamePlainDate;\n"],"mappings":"AAAA,OAAO,oBAAoB;AAE3B,MAAM,kBAAkB,CAAC,GAA8B,MAA0C;AAC/F,QAAM,QAAQ,eAAe,CAAC;AAC9B,QAAM,QAAQ,eAAe,CAAC;AAC9B,MAAI,UAAU,QAAQ,UAAU,KAAM,QAAO;AAC7C,MAAI,UAAU,QAAQ,UAAU,KAAM,QAAO;AAC7C,SAAO,MAAM,OAAO,KAAK;AAC3B;AAEA,IAAO,0BAAQ;","names":[]}
@@ -1,3 +0,0 @@
1
- declare const isValidPlainDate: (date: string | null | undefined) => date is string;
2
-
3
- export { isValidPlainDate as default };
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/utils/isValidPlainDate.ts"],"sourcesContent":["import { Temporal } from \"temporal-polyfill\";\n\nconst isValidPlainDate = (date: string | null | undefined): date is string => {\n if (date === null || date === undefined) return false;\n try {\n return date === Temporal.PlainDate.from(date).toString();\n } catch {\n return false;\n }\n};\n\nexport default isValidPlainDate;\n"],"mappings":"AAAA,SAAS,gBAAgB;AAEzB,MAAM,mBAAmB,CAAC,SAAoD;AAC5E,MAAI,SAAS,QAAQ,SAAS,OAAW,QAAO;AAChD,MAAI;AACF,WAAO,SAAS,SAAS,UAAU,KAAK,IAAI,EAAE,SAAS;AAAA,EACzD,QAAQ;AACN,WAAO;AAAA,EACT;AACF;AAEA,IAAO,2BAAQ;","names":[]}
@@ -1,5 +0,0 @@
1
- import { Temporal } from 'temporal-polyfill';
2
-
3
- declare const parsePlainDate: (date: string | null | undefined) => Temporal.PlainDate | null;
4
-
5
- export { parsePlainDate as default };
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/utils/parsePlainDate.ts"],"sourcesContent":["import { Temporal } from \"temporal-polyfill\";\n\nconst parsePlainDate = (date: string | null | undefined): Temporal.PlainDate | null => {\n if (date === null || date === undefined) return null;\n try {\n return Temporal.PlainDate.from(date);\n } catch {\n return null;\n }\n};\n\nexport default parsePlainDate;\n"],"mappings":"AAAA,SAAS,gBAAgB;AAEzB,MAAM,iBAAiB,CAAC,SAA+D;AACrF,MAAI,SAAS,QAAQ,SAAS,OAAW,QAAO;AAChD,MAAI;AACF,WAAO,SAAS,UAAU,KAAK,IAAI;AAAA,EACrC,QAAQ;AACN,WAAO;AAAA,EACT;AACF;AAEA,IAAO,yBAAQ;","names":[]}
File without changes
File without changes