@ehmpathy/uni-time 1.9.1 → 1.9.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.
- package/dist/{domain → domain.objects}/UniDateTime.d.ts +1 -1
- package/dist/domain.objects/UniDateTime.js.map +1 -0
- package/dist/{domain → domain.objects}/UniDuration.d.ts +2 -2
- package/dist/domain.objects/UniDuration.js.map +1 -0
- package/dist/{logic → domain.operations}/casts/castInputToDate.d.ts +1 -1
- package/dist/{logic → domain.operations}/casts/castInputToDate.js +2 -2
- package/dist/domain.operations/casts/castInputToDate.js.map +1 -0
- package/dist/{logic → domain.operations}/casts/toMillisecondsSinceEpoch.d.ts +1 -1
- package/dist/domain.operations/casts/toMillisecondsSinceEpoch.js.map +1 -0
- package/dist/{logic → domain.operations}/checks/isUniDate.d.ts +2 -2
- package/dist/{logic → domain.operations}/checks/isUniDate.js +5 -4
- package/dist/domain.operations/checks/isUniDate.js.map +1 -0
- package/dist/{logic → domain.operations}/checks/isUniDateRange.d.ts +1 -1
- package/dist/domain.operations/checks/isUniDateRange.js.map +1 -0
- package/dist/{logic → domain.operations}/checks/isUniDateTime.d.ts +2 -2
- package/dist/{logic → domain.operations}/checks/isUniDateTime.js +3 -3
- package/dist/domain.operations/checks/isUniDateTime.js.map +1 -0
- package/dist/{logic → domain.operations}/checks/isUniDateTimeRange.d.ts +1 -1
- package/dist/domain.operations/checks/isUniDateTimeRange.js.map +1 -0
- package/dist/{logic → domain.operations}/checks/isUniMonth.d.ts +2 -2
- package/dist/{logic → domain.operations}/checks/isUniMonth.js +5 -4
- package/dist/domain.operations/checks/isUniMonth.js.map +1 -0
- package/dist/{logic → domain.operations}/manipulate/addDuration.d.ts +3 -3
- package/dist/domain.operations/manipulate/addDuration.js +18 -0
- package/dist/domain.operations/manipulate/addDuration.js.map +1 -0
- package/dist/{logic → domain.operations}/manipulate/asDurationInWords.d.ts +1 -1
- package/dist/domain.operations/manipulate/asDurationInWords.js.map +1 -0
- package/dist/{logic → domain.operations}/manipulate/getDuration.d.ts +3 -3
- package/dist/{logic → domain.operations}/manipulate/getDuration.js +4 -4
- package/dist/domain.operations/manipulate/getDuration.js.map +1 -0
- package/dist/{logic → domain.operations}/manipulate/subDuration.d.ts +3 -3
- package/dist/domain.operations/manipulate/subDuration.js +18 -0
- package/dist/domain.operations/manipulate/subDuration.js.map +1 -0
- package/dist/{logic → domain.operations}/manipulate/toMilliseconds.d.ts +1 -1
- package/dist/domain.operations/manipulate/toMilliseconds.js.map +1 -0
- package/dist/{logic → domain.operations}/observe/stopwatch/startDurationStopwatch.d.ts +1 -1
- package/dist/{logic → domain.operations}/observe/stopwatch/startDurationStopwatch.js +1 -1
- package/dist/domain.operations/observe/stopwatch/startDurationStopwatch.js.map +1 -0
- package/dist/{logic → domain.operations}/utils/sleep.d.ts +1 -1
- package/dist/{logic → domain.operations}/utils/sleep.js +1 -1
- package/dist/domain.operations/utils/sleep.js.map +1 -0
- package/dist/{logic → domain.operations}/wrappers/waitFor.d.ts +3 -3
- package/dist/{logic → domain.operations}/wrappers/waitFor.js +4 -4
- package/dist/domain.operations/wrappers/waitFor.js.map +1 -0
- package/dist/index.d.ts +15 -15
- package/dist/index.js +15 -15
- package/dist/index.js.map +1 -1
- package/package.json +51 -42
- package/dist/domain/UniDateTime.js.map +0 -1
- package/dist/domain/UniDateTime.test.d.ts +0 -1
- package/dist/domain/UniDateTime.test.js +0 -75
- package/dist/domain/UniDateTime.test.js.map +0 -1
- package/dist/domain/UniDuration.js.map +0 -1
- package/dist/logic/casts/castInputToDate.js.map +0 -1
- package/dist/logic/casts/toMillisecondsSinceEpoch.js.map +0 -1
- package/dist/logic/checks/isUniDate.js.map +0 -1
- package/dist/logic/checks/isUniDate.test.d.ts +0 -1
- package/dist/logic/checks/isUniDate.test.js +0 -27
- package/dist/logic/checks/isUniDate.test.js.map +0 -1
- package/dist/logic/checks/isUniDateRange.js.map +0 -1
- package/dist/logic/checks/isUniDateTime.js.map +0 -1
- package/dist/logic/checks/isUniDateTime.test.d.ts +0 -1
- package/dist/logic/checks/isUniDateTime.test.js +0 -51
- package/dist/logic/checks/isUniDateTime.test.js.map +0 -1
- package/dist/logic/checks/isUniDateTimeRange.js.map +0 -1
- package/dist/logic/checks/isUniMonth.js.map +0 -1
- package/dist/logic/checks/isUniMonth.test.d.ts +0 -1
- package/dist/logic/checks/isUniMonth.test.js +0 -43
- package/dist/logic/checks/isUniMonth.test.js.map +0 -1
- package/dist/logic/manipulate/addDuration.js +0 -17
- package/dist/logic/manipulate/addDuration.js.map +0 -1
- package/dist/logic/manipulate/asDurationInWords.js.map +0 -1
- package/dist/logic/manipulate/asDurationInWords.test.d.ts +0 -1
- package/dist/logic/manipulate/asDurationInWords.test.js +0 -16
- package/dist/logic/manipulate/asDurationInWords.test.js.map +0 -1
- package/dist/logic/manipulate/getDuration.js.map +0 -1
- package/dist/logic/manipulate/getDuration.test.d.ts +0 -1
- package/dist/logic/manipulate/getDuration.test.js +0 -127
- package/dist/logic/manipulate/getDuration.test.js.map +0 -1
- package/dist/logic/manipulate/subDuration.js +0 -17
- package/dist/logic/manipulate/subDuration.js.map +0 -1
- package/dist/logic/manipulate/subDuration.test.d.ts +0 -1
- package/dist/logic/manipulate/subDuration.test.js +0 -20
- package/dist/logic/manipulate/subDuration.test.js.map +0 -1
- package/dist/logic/manipulate/toMilliseconds.js.map +0 -1
- package/dist/logic/observe/stopwatch/startDurationStopwatch.js.map +0 -1
- package/dist/logic/utils/sleep.js.map +0 -1
- package/dist/logic/wrappers/waitFor.js.map +0 -1
- /package/dist/{domain → domain.objects}/UniDateTime.js +0 -0
- /package/dist/{domain → domain.objects}/UniDuration.js +0 -0
- /package/dist/{logic → domain.operations}/casts/toMillisecondsSinceEpoch.js +0 -0
- /package/dist/{logic → domain.operations}/checks/isUniDateRange.js +0 -0
- /package/dist/{logic → domain.operations}/checks/isUniDateTimeRange.js +0 -0
- /package/dist/{logic → domain.operations}/manipulate/asDurationInWords.js +0 -0
- /package/dist/{logic → domain.operations}/manipulate/toMilliseconds.js +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"UniDateTime.js","sourceRoot":"","sources":["../../src/domain.objects/UniDateTime.ts"],"names":[],"mappings":""}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { AsOfGlossary } from 'domain-glossaries';
|
|
2
|
-
import { PickAny } from 'type-fns';
|
|
1
|
+
import type { AsOfGlossary } from 'domain-glossaries';
|
|
2
|
+
import type { PickAny } from 'type-fns';
|
|
3
3
|
export type UniDuration = AsOfGlossary<PickAny<{
|
|
4
4
|
weeks: number;
|
|
5
5
|
days: number;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"UniDuration.js","sourceRoot":"","sources":["../../src/domain.objects/UniDuration.ts"],"names":[],"mappings":""}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.castInputToDate = void 0;
|
|
4
|
-
const
|
|
4
|
+
const helpful_errors_1 = require("helpful-errors");
|
|
5
5
|
const castInputToDate = (input) => {
|
|
6
6
|
if (input instanceof Date)
|
|
7
7
|
return input;
|
|
@@ -11,7 +11,7 @@ const castInputToDate = (input) => {
|
|
|
11
11
|
return input.date;
|
|
12
12
|
if (input.mse)
|
|
13
13
|
return new Date(input.mse);
|
|
14
|
-
throw new
|
|
14
|
+
throw new helpful_errors_1.UnexpectedCodePathError('could not parse date from input', {
|
|
15
15
|
input,
|
|
16
16
|
});
|
|
17
17
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"castInputToDate.js","sourceRoot":"","sources":["../../../src/domain.operations/casts/castInputToDate.ts"],"names":[],"mappings":";;;AAAA,mDAAyD;AAGlD,MAAM,eAAe,GAAG,CAC7B,KAaM,EACA,EAAE;IACR,IAAI,KAAK,YAAY,IAAI;QAAE,OAAO,KAAK,CAAC;IACxC,IAAI,OAAO,KAAK,KAAK,QAAQ;QAAE,OAAO,IAAI,IAAI,CAAC,KAAK,CAAC,CAAC;IACtD,IAAI,KAAK,CAAC,IAAI;QAAE,OAAO,KAAK,CAAC,IAAI,CAAC;IAClC,IAAI,KAAK,CAAC,GAAG;QAAE,OAAO,IAAI,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IAC1C,MAAM,IAAI,wCAAuB,CAAC,iCAAiC,EAAE;QACnE,KAAK;KACN,CAAC,CAAC;AACL,CAAC,CAAC;AAvBW,QAAA,eAAe,mBAuB1B"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { UniDate, UniDateTime } from '../../domain/UniDateTime';
|
|
1
|
+
import type { UniDate, UniDateTime } from '../../domain.objects/UniDateTime';
|
|
2
2
|
export declare const toMillisecondsSinceEpoch: (input: UniDate | UniDateTime) => number;
|
|
3
3
|
export { toMillisecondsSinceEpoch as toMse };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"toMillisecondsSinceEpoch.js","sourceRoot":"","sources":["../../../src/domain.operations/casts/toMillisecondsSinceEpoch.ts"],"names":[],"mappings":";;;AAEO,MAAM,wBAAwB,GAAG,CACtC,KAA4B,EACpB,EAAE,CAAC,IAAI,IAAI,CAAC,KAAK,CAAC,CAAC,OAAO,EAAE,CAAC;AAF1B,QAAA,wBAAwB,4BAEE;AAEF,gBAJxB,gCAAwB,CAIK"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { UniDate } from '../../domain/UniDateTime';
|
|
2
|
-
import { castInputToDate } from '
|
|
1
|
+
import type { UniDate } from '../../domain.objects/UniDateTime';
|
|
2
|
+
import { castInputToDate } from '../../domain.operations/casts/castInputToDate';
|
|
3
3
|
/**
|
|
4
4
|
* casts a date like input into a UniDate
|
|
5
5
|
*/
|
|
@@ -1,20 +1,21 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.isUniDate = exports.asUniDate = void 0;
|
|
4
|
-
const
|
|
4
|
+
const format_1 = require("date-fns/format");
|
|
5
|
+
const parseISO_1 = require("date-fns/parseISO");
|
|
5
6
|
const type_fns_1 = require("type-fns");
|
|
6
|
-
const castInputToDate_1 = require("
|
|
7
|
+
const castInputToDate_1 = require("../../domain.operations/casts/castInputToDate");
|
|
7
8
|
/**
|
|
8
9
|
* casts a date like input into a UniDate
|
|
9
10
|
*/
|
|
10
|
-
const asUniDate = (input) => (0,
|
|
11
|
+
const asUniDate = (input) => (0, format_1.format)((0, castInputToDate_1.castInputToDate)(input), 'yyyy-MM-dd');
|
|
11
12
|
exports.asUniDate = asUniDate;
|
|
12
13
|
/**
|
|
13
14
|
* checks whether a string literal input is a UniDate
|
|
14
15
|
*/
|
|
15
16
|
exports.isUniDate = (0, type_fns_1.withAssure)((input) => {
|
|
16
17
|
try {
|
|
17
|
-
return (0, exports.asUniDate)((0,
|
|
18
|
+
return (0, exports.asUniDate)((0, parseISO_1.parseISO)(input)) === input;
|
|
18
19
|
}
|
|
19
20
|
catch {
|
|
20
21
|
return false;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"isUniDate.js","sourceRoot":"","sources":["../../../src/domain.operations/checks/isUniDate.ts"],"names":[],"mappings":";;;AAAA,4CAAyC;AACzC,gDAA6C;AAC7C,uCAAsC;AAGtC,kFAA+E;AAE/E;;GAEG;AACI,MAAM,SAAS,GAAG,CACvB,KAA4C,EACnC,EAAE,CAAC,IAAA,eAAM,EAAC,IAAA,iCAAe,EAAC,KAAK,CAAC,EAAE,YAAY,CAAY,CAAC;AAFzD,QAAA,SAAS,aAEgD;AAEtE;;GAEG;AACU,QAAA,SAAS,GAAG,IAAA,qBAAU,EAAC,CAAC,KAAa,EAAoB,EAAE;IACtE,IAAI,CAAC;QACH,OAAO,IAAA,iBAAS,EAAC,IAAA,mBAAQ,EAAC,KAAK,CAAC,CAAC,KAAK,KAAK,CAAC;IAC9C,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,KAAK,CAAC;IACf,CAAC;AACH,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"isUniDateRange.js","sourceRoot":"","sources":["../../../src/domain.operations/checks/isUniDateRange.ts"],"names":[],"mappings":";;;AAAA,uCAAsC;AAItC,2CAAmD;AAEnD;;GAEG;AACI,MAAM,cAAc,GAAG,CAAC,KAG9B,EAAgB,EAAE,CAAC,CAAC;IACnB,KAAK,EAAE,IAAA,qBAAS,EAAC,KAAK,CAAC,KAAK,CAAC;IAC7B,KAAK,EAAE,IAAA,qBAAS,EAAC,KAAK,CAAC,KAAK,CAAC;CAC9B,CAAC,CAAC;AANU,QAAA,cAAc,kBAMxB;AAEH;;GAEG;AACU,QAAA,cAAc,GAAG,IAAA,qBAAU,EACtC,CAAC,KAAU,EAAyB,EAAE;IACpC,IAAI,CAAC,KAAK,IAAI,OAAO,KAAK,KAAK,QAAQ;QAAE,OAAO,KAAK,CAAC;IACtD,OAAO,IAAA,qBAAS,EAAC,KAAK,CAAC,KAAK,CAAC,IAAI,IAAA,qBAAS,EAAC,KAAK,CAAC,KAAK,CAAC,CAAC;AAC1D,CAAC,CACF,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { UniDateTime } from '../../domain/UniDateTime';
|
|
2
|
-
import { castInputToDate } from '
|
|
1
|
+
import type { UniDateTime } from '../../domain.objects/UniDateTime';
|
|
2
|
+
import { castInputToDate } from '../../domain.operations/casts/castInputToDate';
|
|
3
3
|
/**
|
|
4
4
|
* casts a datetime like input into a uniDateTime
|
|
5
5
|
*/
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.isUniDateTime = exports.asUniDateTime = void 0;
|
|
4
|
-
const
|
|
4
|
+
const parseISO_1 = require("date-fns/parseISO");
|
|
5
5
|
const type_fns_1 = require("type-fns");
|
|
6
|
-
const castInputToDate_1 = require("
|
|
6
|
+
const castInputToDate_1 = require("../../domain.operations/casts/castInputToDate");
|
|
7
7
|
/**
|
|
8
8
|
* casts a datetime like input into a uniDateTime
|
|
9
9
|
*/
|
|
@@ -14,7 +14,7 @@ exports.asUniDateTime = asUniDateTime;
|
|
|
14
14
|
*/
|
|
15
15
|
exports.isUniDateTime = (0, type_fns_1.withAssure)((input) => {
|
|
16
16
|
try {
|
|
17
|
-
return (0, exports.asUniDateTime)((0,
|
|
17
|
+
return (0, exports.asUniDateTime)((0, parseISO_1.parseISO)(input)) === input;
|
|
18
18
|
}
|
|
19
19
|
catch {
|
|
20
20
|
return false;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"isUniDateTime.js","sourceRoot":"","sources":["../../../src/domain.operations/checks/isUniDateTime.ts"],"names":[],"mappings":";;;AAAA,gDAA6C;AAC7C,uCAAsC;AAGtC,kFAA+E;AAE/E;;GAEG;AACI,MAAM,aAAa,GAAG,CAC3B,KAA4C,EAC/B,EAAE,CAAC,IAAA,iCAAe,EAAC,KAAK,CAAC,CAAC,WAAW,EAAiB,CAAC;AAFzD,QAAA,aAAa,iBAE4C;AAEtE;;GAEG;AACU,QAAA,aAAa,GAAG,IAAA,qBAAU,EACrC,CAAC,KAAa,EAAwB,EAAE;IACtC,IAAI,CAAC;QACH,OAAO,IAAA,qBAAa,EAAC,IAAA,mBAAQ,EAAC,KAAK,CAAC,CAAC,KAAK,KAAK,CAAC;IAClD,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,KAAK,CAAC;IACf,CAAC;AACH,CAAC,CACF,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"isUniDateTimeRange.js","sourceRoot":"","sources":["../../../src/domain.operations/checks/isUniDateTimeRange.ts"],"names":[],"mappings":";;;AAAA,uCAAsC;AAItC,mDAA+D;AAE/D;;GAEG;AACI,MAAM,kBAAkB,GAAG,CAAC,KAGlC,EAAoB,EAAE,CAAC,CAAC;IACvB,KAAK,EAAE,IAAA,6BAAa,EAAC,KAAK,CAAC,KAAK,CAAC;IACjC,KAAK,EAAE,IAAA,6BAAa,EAAC,KAAK,CAAC,KAAK,CAAC;CAClC,CAAC,CAAC;AANU,QAAA,kBAAkB,sBAM5B;AAEH;;GAEG;AACU,QAAA,kBAAkB,GAAG,IAAA,qBAAU,EAC1C,CAAC,KAAU,EAA6B,EAAE;IACxC,IAAI,CAAC,KAAK,IAAI,OAAO,KAAK,KAAK,QAAQ;QAAE,OAAO,KAAK,CAAC;IACtD,OAAO,IAAA,6BAAa,EAAC,KAAK,CAAC,KAAK,CAAC,IAAI,IAAA,6BAAa,EAAC,KAAK,CAAC,KAAK,CAAC,CAAC;AAClE,CAAC,CACF,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { UniMonth } from '../../domain/UniDateTime';
|
|
2
|
-
import { castInputToDate } from '
|
|
1
|
+
import type { UniMonth } from '../../domain.objects/UniDateTime';
|
|
2
|
+
import { castInputToDate } from '../../domain.operations/casts/castInputToDate';
|
|
3
3
|
/**
|
|
4
4
|
* casts a date like input into a UniDate
|
|
5
5
|
*/
|
|
@@ -1,20 +1,21 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.isUniMonth = exports.asUniMonth = void 0;
|
|
4
|
-
const
|
|
4
|
+
const format_1 = require("date-fns/format");
|
|
5
|
+
const parseISO_1 = require("date-fns/parseISO");
|
|
5
6
|
const type_fns_1 = require("type-fns");
|
|
6
|
-
const castInputToDate_1 = require("
|
|
7
|
+
const castInputToDate_1 = require("../../domain.operations/casts/castInputToDate");
|
|
7
8
|
/**
|
|
8
9
|
* casts a date like input into a UniDate
|
|
9
10
|
*/
|
|
10
|
-
const asUniMonth = (input) => (0,
|
|
11
|
+
const asUniMonth = (input) => (0, format_1.format)((0, castInputToDate_1.castInputToDate)(input), 'yyyy-MM');
|
|
11
12
|
exports.asUniMonth = asUniMonth;
|
|
12
13
|
/**
|
|
13
14
|
* checks whether a string literal input is a UniDate
|
|
14
15
|
*/
|
|
15
16
|
exports.isUniMonth = (0, type_fns_1.withAssure)((input) => {
|
|
16
17
|
try {
|
|
17
|
-
return (0, exports.asUniMonth)((0,
|
|
18
|
+
return (0, exports.asUniMonth)((0, parseISO_1.parseISO)(input)) === input;
|
|
18
19
|
}
|
|
19
20
|
catch {
|
|
20
21
|
return false;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"isUniMonth.js","sourceRoot":"","sources":["../../../src/domain.operations/checks/isUniMonth.ts"],"names":[],"mappings":";;;AAAA,4CAAyC;AACzC,gDAA6C;AAC7C,uCAAsC;AAGtC,kFAA+E;AAE/E;;GAEG;AACI,MAAM,UAAU,GAAG,CACxB,KAA4C,EAClC,EAAE,CAAC,IAAA,eAAM,EAAC,IAAA,iCAAe,EAAC,KAAK,CAAC,EAAE,SAAS,CAAa,CAAC;AAFxD,QAAA,UAAU,cAE8C;AAErE;;GAEG;AACU,QAAA,UAAU,GAAG,IAAA,qBAAU,EAAC,CAAC,KAAa,EAAqB,EAAE;IACxE,IAAI,CAAC;QACH,OAAO,IAAA,kBAAU,EAAC,IAAA,mBAAQ,EAAC,KAAK,CAAC,CAAC,KAAK,KAAK,CAAC;IAC/C,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,KAAK,CAAC;IACf,CAAC;AACH,CAAC,CAAC,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { PickOne } from 'type-fns';
|
|
2
|
-
import { UniDate, UniDateTime } from '../../domain/UniDateTime';
|
|
3
|
-
import { UniDuration } from '../../domain/UniDuration';
|
|
1
|
+
import type { PickOne } from 'type-fns';
|
|
2
|
+
import type { UniDate, UniDateTime } from '../../domain.objects/UniDateTime';
|
|
3
|
+
import type { UniDuration } from '../../domain.objects/UniDuration';
|
|
4
4
|
export declare function addDuration(...args: [UniDateTime, UniDuration]): UniDateTime;
|
|
5
5
|
export declare function addDuration(...args: [UniDate, PickOne<Pick<Required<UniDuration>, 'days'>>]): UniDate;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.addDuration = void 0;
|
|
4
|
+
const addMilliseconds_1 = require("date-fns/addMilliseconds");
|
|
5
|
+
const parseISO_1 = require("date-fns/parseISO");
|
|
6
|
+
const isUniDate_1 = require("../../domain.operations/checks/isUniDate");
|
|
7
|
+
const isUniDateTime_1 = require("../../domain.operations/checks/isUniDateTime");
|
|
8
|
+
const toMilliseconds_1 = require("./toMilliseconds");
|
|
9
|
+
/**
|
|
10
|
+
* add a duration to a datetime
|
|
11
|
+
*/
|
|
12
|
+
function addDuration(...args) {
|
|
13
|
+
return (0, isUniDate_1.isUniDate)(args[0])
|
|
14
|
+
? (0, isUniDate_1.asUniDate)((0, addMilliseconds_1.addMilliseconds)((0, parseISO_1.parseISO)(args[0]), (0, toMilliseconds_1.toMilliseconds)(args[1])))
|
|
15
|
+
: (0, isUniDateTime_1.asUniDateTime)((0, addMilliseconds_1.addMilliseconds)((0, parseISO_1.parseISO)(args[0]), (0, toMilliseconds_1.toMilliseconds)(args[1])));
|
|
16
|
+
}
|
|
17
|
+
exports.addDuration = addDuration;
|
|
18
|
+
//# sourceMappingURL=addDuration.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"addDuration.js","sourceRoot":"","sources":["../../../src/domain.operations/manipulate/addDuration.ts"],"names":[],"mappings":";;;AAAA,8DAA2D;AAC3D,gDAA6C;AAK7C,uEAA+E;AAC/E,+EAA4E;AAE5E,qDAAkD;AAOlD;;GAEG;AACH,SAAgB,WAAW,CACzB,GAAG,IAEwD;IAE3D,OAAO,IAAA,qBAAS,EAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QACvB,CAAC,CAAC,IAAA,qBAAS,EAAC,IAAA,iCAAe,EAAC,IAAA,mBAAQ,EAAC,IAAI,CAAC,CAAC,CAAC,CAAC,EAAE,IAAA,+BAAc,EAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QACxE,CAAC,CAAC,IAAA,6BAAa,EACX,IAAA,iCAAe,EAAC,IAAA,mBAAQ,EAAC,IAAI,CAAC,CAAC,CAAC,CAAC,EAAE,IAAA,+BAAc,EAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAC5D,CAAC;AACR,CAAC;AAVD,kCAUC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"asDurationInWords.js","sourceRoot":"","sources":["../../../src/domain.operations/manipulate/asDurationInWords.ts"],"names":[],"mappings":";;;AAEA,MAAM,cAAc,GAAG;IACrB,OAAO;IACP,MAAM;IACN,OAAO;IACP,SAAS;IACT,SAAS;IACT,cAAc;CACN,CAAC;AAIX,MAAM,YAAY,GAAyB;IACzC,KAAK,EAAE,GAAG;IACV,IAAI,EAAE,GAAG;IACT,KAAK,EAAE,GAAG;IACV,OAAO,EAAE,GAAG;IACZ,OAAO,EAAE,GAAG;IACZ,YAAY,EAAE,IAAI;CACnB,CAAC;AAEF;;;;;;;;;GASG;AACI,MAAM,iBAAiB,GAAG,CAAC,QAAqB,EAAU,EAAE;IACjE,MAAM,IAAI,GAAyB,MAAM,CAAC,WAAW,CACnD,cAAc,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE;QACvB,MAAM,CAAC,GAAG,MAAM,CAAE,QAAgB,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC;QAC9C,OAAO,CAAC,CAAC,EAAE,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IACtD,CAAC,CAAC,CACqB,CAAC;IAE1B,MAAM,KAAK,GAAa,EAAE,CAAC;IAC3B,KAAK,MAAM,CAAC,IAAI,cAAc,EAAE,CAAC;QAC/B,MAAM,CAAC,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC;QAClB,IAAI,CAAC,CAAC;YAAE,SAAS;QACjB,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,YAAY,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;QACrC,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC;YAAE,MAAM;IAChC,CAAC;IAED,OAAO,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;AAC/C,CAAC,CAAC;AAjBW,QAAA,iBAAiB,qBAiB5B"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { PickOne } from 'type-fns';
|
|
2
|
-
import { UniDateTimeRange } from '../../domain/UniDateTime';
|
|
3
|
-
import { UniDuration } from '../../domain/UniDuration';
|
|
1
|
+
import type { PickOne } from 'type-fns';
|
|
2
|
+
import type { UniDateTimeRange } from '../../domain.objects/UniDateTime';
|
|
3
|
+
import type { UniDuration } from '../../domain.objects/UniDuration';
|
|
4
4
|
/**
|
|
5
5
|
* .what = calculates the duration of a time range
|
|
6
6
|
*/
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.getDuration = void 0;
|
|
4
|
-
const
|
|
5
|
-
const toMillisecondsSinceEpoch_1 = require("
|
|
4
|
+
const helpful_errors_1 = require("helpful-errors");
|
|
5
|
+
const toMillisecondsSinceEpoch_1 = require("../../domain.operations/casts/toMillisecondsSinceEpoch");
|
|
6
6
|
const toMilliseconds_1 = require("./toMilliseconds");
|
|
7
7
|
/**
|
|
8
8
|
* .what = calculates the duration of a time range
|
|
@@ -32,7 +32,7 @@ const getDuration = (input) => {
|
|
|
32
32
|
return { seconds: input.of.milliseconds / toMilliseconds_1.MILLISECONDS_PER_SECOND };
|
|
33
33
|
if (input.as === 'milliseconds')
|
|
34
34
|
return { milliseconds: input.of.milliseconds };
|
|
35
|
-
throw new
|
|
35
|
+
throw new helpful_errors_1.UnexpectedCodePathError('input.as does not specify a valid unit', { input });
|
|
36
36
|
}
|
|
37
37
|
// otherwise, define it via all of the units
|
|
38
38
|
const weeks = Math.floor(input.of.milliseconds / toMilliseconds_1.MILLISECONDS_PER_WEEK);
|
|
@@ -62,7 +62,7 @@ const getDuration = (input) => {
|
|
|
62
62
|
return duration;
|
|
63
63
|
}
|
|
64
64
|
// otherwise, unsupported
|
|
65
|
-
throw new
|
|
65
|
+
throw new helpful_errors_1.UnexpectedCodePathError('input.of choice is not supported', {
|
|
66
66
|
input,
|
|
67
67
|
});
|
|
68
68
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getDuration.js","sourceRoot":"","sources":["../../../src/domain.operations/manipulate/getDuration.ts"],"names":[],"mappings":";;;AAAA,mDAAyD;AAKzD,oGAA8E;AAE9E,qDAM0B;AAE1B;;GAEG;AACI,MAAM,WAAW,GAAG,CAAC,KAa3B,EAAe,EAAE;IAChB,sBAAsB;IACtB,IAAI,KAAK,CAAC,EAAE,CAAC,KAAK;QAChB,OAAO,IAAA,mBAAW,EAAC;YACjB,EAAE,EAAE;gBACF,YAAY,EAAE,IAAA,gCAAK,EAAC,KAAK,CAAC,EAAE,CAAC,KAAK,CAAC,KAAK,CAAC,GAAG,IAAA,gCAAK,EAAC,KAAK,CAAC,EAAE,CAAC,KAAK,CAAC,KAAK,CAAC;aACxE;YACD,EAAE,EAAE,KAAK,CAAC,EAAE;SACb,CAAC,CAAC;IAEL,sBAAsB;IACtB,IAAI,KAAK,CAAC,EAAE,CAAC,YAAY,KAAK,SAAS,EAAE,CAAC;QACxC,gEAAgE;QAChE,IAAI,KAAK,CAAC,EAAE,EAAE,CAAC;YACb,IAAI,KAAK,CAAC,EAAE,KAAK,OA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KAAK,CACxB,CAAC,KAAK,CAAC,EAAE,CAAC,YAAY,GAAG,sCAAqB,CAAC,GAAG,wCAAuB,CAC1E,CAAC;QACF,MAAM,OAAO,GAAG,IAAI,CAAC,KAAK,CACxB,CAAC,KAAK,CAAC,EAAE,CAAC,YAAY,GAAG,wCAAuB,CAAC;YAC/C,wCAAuB,CAC1B,CAAC;QACF,MAAM,YAAY,GAAG,KAAK,CAAC,EAAE,CAAC,YAAY,GAAG,wCAAuB,CAAC;QACrE,MAAM,0BAA0B,GAAG;YACjC,KAAK;YACL,IAAI;YACJ,KAAK;YACL,OAAO;YACP,OAAO;YACP,YAAY;SACb,CAAC;QACF,MAAM,eAAe,GACnB,YAAY,KAAK,CAAC;YAClB,KAAK,KAAK,CAAC;YACX,IAAI,KAAK,CAAC;YACV,KAAK,KAAK,CAAC;YACX,OAAO,KAAK,CAAC;YACb,OAAO,KAAK,CAAC,CAAC;QAChB,MAAM,QAAQ,GAAG,MAAM,CAAC,WAAW,CACjC,MAAM,CAAC,OAAO,CAAC,0BAA0B,CAAC,CAAC,MAAM,CAC/C,CAAC,CAAC,GAAG,EAAE,GAAG,CAAC,EAAE,EAAE,CACb,GAAG,GAAG,CAAC;YACP,+BAA+B;YAC/B,CAAC,GAAG,KAAK,cAAc,IAAI,eAAe,CAAC,CAC9C,CACoB,CAAC;QACxB,OAAO,QAAQ,CAAC;IAClB,CAAC;IAED,yBAAyB;IACzB,MAAM,IAAI,wCAAuB,CAAC,kCAAkC,EAAE;QACpE,KAAK;KACN,CAAC,CAAC;AACL,CAAC,CAAC;AA3FW,QAAA,WAAW,eA2FtB"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { PickOne } from 'type-fns';
|
|
2
|
-
import { UniDate, UniDateTime } from '../../domain/UniDateTime';
|
|
3
|
-
import { UniDuration } from '../../domain/UniDuration';
|
|
1
|
+
import type { PickOne } from 'type-fns';
|
|
2
|
+
import type { UniDate, UniDateTime } from '../../domain.objects/UniDateTime';
|
|
3
|
+
import type { UniDuration } from '../../domain.objects/UniDuration';
|
|
4
4
|
export declare function subDuration(...args: [UniDateTime, UniDuration]): UniDateTime;
|
|
5
5
|
export declare function subDuration(...args: [UniDate, PickOne<Pick<Required<UniDuration>, 'days'>>]): UniDate;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.subDuration = void 0;
|
|
4
|
+
const parseISO_1 = require("date-fns/parseISO");
|
|
5
|
+
const subMilliseconds_1 = require("date-fns/subMilliseconds");
|
|
6
|
+
const isUniDate_1 = require("../../domain.operations/checks/isUniDate");
|
|
7
|
+
const isUniDateTime_1 = require("../../domain.operations/checks/isUniDateTime");
|
|
8
|
+
const toMilliseconds_1 = require("./toMilliseconds");
|
|
9
|
+
/**
|
|
10
|
+
* subtract a duration from a datetime
|
|
11
|
+
*/
|
|
12
|
+
function subDuration(...args) {
|
|
13
|
+
return (0, isUniDate_1.isUniDate)(args[0])
|
|
14
|
+
? (0, isUniDate_1.asUniDate)((0, subMilliseconds_1.subMilliseconds)((0, parseISO_1.parseISO)(args[0]), (0, toMilliseconds_1.toMilliseconds)(args[1])))
|
|
15
|
+
: (0, isUniDateTime_1.asUniDateTime)((0, subMilliseconds_1.subMilliseconds)((0, parseISO_1.parseISO)(args[0]), (0, toMilliseconds_1.toMilliseconds)(args[1])));
|
|
16
|
+
}
|
|
17
|
+
exports.subDuration = subDuration;
|
|
18
|
+
//# sourceMappingURL=subDuration.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"subDuration.js","sourceRoot":"","sources":["../../../src/domain.operations/manipulate/subDuration.ts"],"names":[],"mappings":";;;AAAA,gDAA6C;AAC7C,8DAA2D;AAK3D,uEAA+E;AAC/E,+EAA4E;AAE5E,qDAAkD;AAOlD;;GAEG;AACH,SAAgB,WAAW,CACzB,GAAG,IAEwD;IAE3D,OAAO,IAAA,qBAAS,EAAC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AQ,CAAC,OAAO,IAAI,CAAC,CAAC,GAAG,+BAAuB;QACjD,CAAC,QAAQ,CAAC,OAAO,IAAI,CAAC,CAAC,GAAG,+BAAuB;QACjD,QAAQ,CAAC,YAAY,IAAI,CAAC;KAC3B,CAAC,MAAM,CAAC,CAAC,QAAQ,EAAE,gBAAgB,EAAE,EAAE,CAAC,QAAQ,GAAG,gBAAgB,EAAE,CAAC,CAAC,CAAC;IACzE,OAAO,KAAK,CAAC;AACf,CAAC,CAAC;AAVW,QAAA,cAAc,kBAUzB"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { LogLevel } from 'simple-leveled-log-methods';
|
|
2
2
|
import type { VisualogicContext } from 'visualogic';
|
|
3
|
-
import { UniDuration } from '../../../domain/UniDuration';
|
|
3
|
+
import type { UniDuration } from '../../../domain.objects/UniDuration';
|
|
4
4
|
interface StopOptions {
|
|
5
5
|
log?: boolean | {
|
|
6
6
|
threshold?: UniDuration;
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.startDurationStopwatch = void 0;
|
|
4
4
|
const process_1 = require("process");
|
|
5
|
-
const toMilliseconds_1 = require("
|
|
5
|
+
const toMilliseconds_1 = require("../../../domain.operations/manipulate/toMilliseconds");
|
|
6
6
|
const roundToHundredths = (num) => Math.round(num * 100) / 100; // https://stackoverflow.com/a/14968691/3068233
|
|
7
7
|
/**
|
|
8
8
|
* .what = a procedure which returns a duration stopwatch
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"startDurationStopwatch.js","sourceRoot":"","sources":["../../../../src/domain.operations/observe/stopwatch/startDurationStopwatch.ts"],"names":[],"mappings":";;;AAAA,qCAAiC;AAKjC,qFAAkF;AAElF,MAAM,iBAAiB,GAAG,CAAC,GAAW,EAAE,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,GAAG,GAAG,CAAC,GAAG,GAAG,CAAC,CAAC,+CA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AC,CAAC,OAAO;YACT,CAAC,CAAC,UAAU,CAAC,KAAK,CAAC;QACvB,MAAM,iBAAiB,GAAG,iBAAiB,CACzC,MAAM,CAAC,qBAAqB,CAAC,GAAG,GAAG,CACpC,CAAC,CAAC,+CAA+C;QAClD,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC,CACnB,GAAG,KAAK,SAAS,iBAAiB,qBAAqB,EACvD;YACE,GAAG,EAAE,KAAK;YACV,QAAQ,EAAE;gBACR,OAAO,EAAE,iBAAiB;gBAC1B,YAAY,EAAE,sBAAsB;aACrC;SACF,CACF,CAAC;QACF,OAAO,MAAM,CAAC;IAChB,CAAC,CAAC;IAEF,uBAAuB;IACvB,OAAO;QACL,sCAAsC;QACtC,IAAI;KACL,CAAC;AACJ,CAAC,CAAC;AA9DW,QAAA,sBAAsB,0BA8DjC"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { UniDuration } from '../../domain/UniDuration';
|
|
1
|
+
import type { UniDuration } from '../../domain.objects/UniDuration';
|
|
2
2
|
export declare const sleep: (ms: number | UniDuration) => Promise<void>;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.sleep = void 0;
|
|
4
|
-
const toMilliseconds_1 = require("
|
|
4
|
+
const toMilliseconds_1 = require("../../domain.operations/manipulate/toMilliseconds");
|
|
5
5
|
const sleep = (ms) => new Promise((resolve) => setTimeout(resolve, typeof ms === 'number' ? ms : (0, toMilliseconds_1.toMilliseconds)(ms)));
|
|
6
6
|
exports.sleep = sleep;
|
|
7
7
|
//# sourceMappingURL=sleep.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sleep.js","sourceRoot":"","sources":["../../../src/domain.operations/utils/sleep.ts"],"names":[],"mappings":";;;AACA,qFAAkF;AAE3E,MAAM,KAAK,GAAG,CAAC,EAAwB,EAAiB,EAAE,CAC/D,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE,CACtB,UAAU,CAAC,OAAO,EAAE,OAAO,EAAE,KAAK,QAAQ,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAA,+BAAc,EAAC,EAAE,CAAC,CAAC,CACtE,CAAC;AAHS,QAAA,KAAK,SAGd"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { HelpfulError } from '
|
|
2
|
-
import { NotUndefined } from 'type-fns';
|
|
3
|
-
import { UniDuration } from '../../domain/UniDuration';
|
|
1
|
+
import { HelpfulError } from 'helpful-errors';
|
|
2
|
+
import { type NotUndefined } from 'type-fns';
|
|
3
|
+
import type { UniDuration } from '../../domain.objects/UniDuration';
|
|
4
4
|
export declare class WaitForTimedOutError extends HelpfulError {
|
|
5
5
|
}
|
|
6
6
|
/**
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.waitFor = exports.WaitForTimedOutError = void 0;
|
|
4
|
-
const
|
|
4
|
+
const helpful_errors_1 = require("helpful-errors");
|
|
5
5
|
const type_fns_1 = require("type-fns");
|
|
6
|
-
const toMilliseconds_1 = require("
|
|
7
|
-
const sleep_1 = require("
|
|
6
|
+
const toMilliseconds_1 = require("../../domain.operations/manipulate/toMilliseconds");
|
|
7
|
+
const sleep_1 = require("../../domain.operations/utils/sleep");
|
|
8
8
|
const DEFAULT_TIMEOUT = { seconds: 60 };
|
|
9
9
|
const DEFAULT_INTERVAL = { seconds: 10 };
|
|
10
|
-
class WaitForTimedOutError extends
|
|
10
|
+
class WaitForTimedOutError extends helpful_errors_1.HelpfulError {
|
|
11
11
|
}
|
|
12
12
|
exports.WaitForTimedOutError = WaitForTimedOutError;
|
|
13
13
|
/**
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"waitFor.js","sourceRoot":"","sources":["../../../src/domain.operations/wrappers/waitFor.ts"],"names":[],"mappings":";;;AAAA,mDAA8C;AAC9C,uCAA6D;AAG7D,qFAAkF;AAClF,8DAA2D;AAE3D,MAAM,eAAe,GAAgB,EAAE,OAAO,EAAE,EAAE,EAAE,CAAC;AACrD,MAAM,gBAAgB,GAAgB,EAAE,OAAO,EAAE,EAAE,EAAE,CAAC;AAEtD,MAAa,oBAAqB,SAAQ,6BAAY;CAAG;AAAzD,oDAAyD;AAEzD;;;;;;;GAOG;AACI,MAAM,OAAO,GAAG,KAAK;AAC1B;;;;;GAKG;AACH,SAA2B;AAE3B;;GAEG;AACH,OAUC,EACyB,EAAE;IAC5B,kCAAkC;IAClC,MAAM,OAAO,GAAG,OAAO,EAAE,OAAO,IAAI,eAAe,CAAC;IACpD,MAAM,QAAQ,GAAG,OAAO,EAAE,QAAQ,IAAI,gBAAgB,CAAC;IAEvD,mCAAmC;IACnC,MAAM,UAAU,GAAW,IAAI,IAAI,EAAE,CAAC,OAAO,EAAE,CAAC;IAChD,MAAM,YAAY,GAAW,UAAU,GAAG,IAAA,+BAAc,EAAC,OAAO,CAAC,CAAC;IAElE,sBAAsB;IACtB,OAAO,IAAI,IAAI,EAAE,CAAC,OAAO,EAAE,GAAG,YAAY,EAAE,CAAC;QAC3C,MAAM,MAAM,GAAG,MAAM,SAAS,EAAE,CAAC;QACjC,IAAI,IAAA,yBAAc,EAAC,MAAM,CAAC;YAAE,OAAO,MAAM,CAAC;QAC1C,MAAM,IAAA,aAAK,EAAC,QAAQ,CAAC,CAAC;IACxB,CAAC;IAED,6DAA6D;IAC7D,MAAM,IAAI,oBAAoB,CAAC,2CAA2C,EAAE;QAC1E,QAAQ;QACR,OAAO;KACR,CAAC,CAAC;AACL,CAAC,CAAC;AA5CW,QAAA,OAAO,WA4ClB"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
export * from './domain/UniDateTime';
|
|
2
|
-
export * from './domain/UniDuration';
|
|
3
|
-
export * from './
|
|
4
|
-
export * from './
|
|
5
|
-
export * from './
|
|
6
|
-
export * from './
|
|
7
|
-
export * from './
|
|
8
|
-
export * from './
|
|
9
|
-
export * from './
|
|
10
|
-
export * from './
|
|
11
|
-
export * from './
|
|
12
|
-
export * from './
|
|
13
|
-
export * from './
|
|
14
|
-
export * from './
|
|
15
|
-
export * from './
|
|
1
|
+
export * from './domain.objects/UniDateTime';
|
|
2
|
+
export * from './domain.objects/UniDuration';
|
|
3
|
+
export * from './domain.operations/casts/toMillisecondsSinceEpoch';
|
|
4
|
+
export * from './domain.operations/checks/isUniDate';
|
|
5
|
+
export * from './domain.operations/checks/isUniDateTime';
|
|
6
|
+
export * from './domain.operations/checks/isUniDateTimeRange';
|
|
7
|
+
export * from './domain.operations/checks/isUniMonth';
|
|
8
|
+
export * from './domain.operations/manipulate/addDuration';
|
|
9
|
+
export * from './domain.operations/manipulate/asDurationInWords';
|
|
10
|
+
export * from './domain.operations/manipulate/getDuration';
|
|
11
|
+
export * from './domain.operations/manipulate/subDuration';
|
|
12
|
+
export * from './domain.operations/manipulate/toMilliseconds';
|
|
13
|
+
export * from './domain.operations/observe/stopwatch/startDurationStopwatch';
|
|
14
|
+
export * from './domain.operations/utils/sleep';
|
|
15
|
+
export * from './domain.operations/wrappers/waitFor';
|
package/dist/index.js
CHANGED
|
@@ -14,19 +14,19 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
__exportStar(require("./domain/UniDateTime"), exports);
|
|
18
|
-
__exportStar(require("./domain/UniDuration"), exports);
|
|
19
|
-
__exportStar(require("./
|
|
20
|
-
__exportStar(require("./
|
|
21
|
-
__exportStar(require("./
|
|
22
|
-
__exportStar(require("./
|
|
23
|
-
__exportStar(require("./
|
|
24
|
-
__exportStar(require("./
|
|
25
|
-
__exportStar(require("./
|
|
26
|
-
__exportStar(require("./
|
|
27
|
-
__exportStar(require("./
|
|
28
|
-
__exportStar(require("./
|
|
29
|
-
__exportStar(require("./
|
|
30
|
-
__exportStar(require("./
|
|
31
|
-
__exportStar(require("./
|
|
17
|
+
__exportStar(require("./domain.objects/UniDateTime"), exports);
|
|
18
|
+
__exportStar(require("./domain.objects/UniDuration"), exports);
|
|
19
|
+
__exportStar(require("./domain.operations/casts/toMillisecondsSinceEpoch"), exports);
|
|
20
|
+
__exportStar(require("./domain.operations/checks/isUniDate"), exports);
|
|
21
|
+
__exportStar(require("./domain.operations/checks/isUniDateTime"), exports);
|
|
22
|
+
__exportStar(require("./domain.operations/checks/isUniDateTimeRange"), exports);
|
|
23
|
+
__exportStar(require("./domain.operations/checks/isUniMonth"), exports);
|
|
24
|
+
__exportStar(require("./domain.operations/manipulate/addDuration"), exports);
|
|
25
|
+
__exportStar(require("./domain.operations/manipulate/asDurationInWords"), exports);
|
|
26
|
+
__exportStar(require("./domain.operations/manipulate/getDuration"), exports);
|
|
27
|
+
__exportStar(require("./domain.operations/manipulate/subDuration"), exports);
|
|
28
|
+
__exportStar(require("./domain.operations/manipulate/toMilliseconds"), exports);
|
|
29
|
+
__exportStar(require("./domain.operations/observe/stopwatch/startDurationStopwatch"), exports);
|
|
30
|
+
__exportStar(require("./domain.operations/utils/sleep"), exports);
|
|
31
|
+
__exportStar(require("./domain.operations/wrappers/waitFor"), exports);
|
|
32
32
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,+DAA6C;AAC7C,+DAA6C;AAC7C,qFAAmE;AACnE,uEAAqD;AACrD,2EAAyD;AACzD,gFAA8D;AAC9D,wEAAsD;AACtD,6EAA2D;AAC3D,mFAAiE;AACjE,6EAA2D;AAC3D,6EAA2D;AAC3D,gFAA8D;AAC9D,+FAA6E;AAC7E,kEAAgD;AAChD,uEAAqD"}
|