@jonloucks/contracts-ts 1.3.0 → 2.0.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/README.md +69 -21
- package/api/AutoClose.d.ts +2 -2
- package/api/AutoClose.d.ts.map +1 -1
- package/api/AutoClose.js +15 -23
- package/api/AutoClose.js.map +1 -1
- package/api/AutoCloseFactory.d.ts +3 -3
- package/api/AutoCloseFactory.d.ts.map +1 -1
- package/api/AutoCloseFactory.js +5 -9
- package/api/AutoCloseFactory.js.map +1 -1
- package/api/AutoOpen.js +3 -6
- package/api/AutoOpen.js.map +1 -1
- package/api/BasicContract.js +6 -11
- package/api/BasicContract.js.map +1 -1
- package/api/BindStrategy.js +4 -9
- package/api/BindStrategy.js.map +1 -1
- package/api/Contract.js +3 -6
- package/api/Contract.js.map +1 -1
- package/api/ContractException.js +5 -10
- package/api/ContractException.js.map +1 -1
- package/api/ContractFactory.js +3 -6
- package/api/ContractFactory.js.map +1 -1
- package/api/Contracts.d.ts +1 -1
- package/api/Contracts.d.ts.map +1 -1
- package/api/Contracts.js +4 -7
- package/api/Contracts.js.map +1 -1
- package/api/ContractsFactory.js +3 -6
- package/api/ContractsFactory.js.map +1 -1
- package/api/Convenience.d.ts +21 -16
- package/api/Convenience.d.ts.map +1 -1
- package/api/Convenience.js +17 -35
- package/api/Convenience.js.map +1 -1
- package/api/Open.d.ts.map +1 -1
- package/api/Open.js +9 -13
- package/api/Open.js.map +1 -1
- package/api/Promisor.d.ts +9 -5
- package/api/Promisor.d.ts.map +1 -1
- package/api/Promisor.js +18 -23
- package/api/Promisor.js.map +1 -1
- package/api/PromisorFactory.d.ts +3 -2
- package/api/PromisorFactory.d.ts.map +1 -1
- package/api/PromisorFactory.js +5 -9
- package/api/PromisorFactory.js.map +1 -1
- package/api/RatifiedContract.js +11 -16
- package/api/RatifiedContract.js.map +1 -1
- package/api/Repository.d.ts +2 -2
- package/api/Repository.d.ts.map +1 -1
- package/api/Repository.js +4 -7
- package/api/Repository.js.map +1 -1
- package/api/RepositoryFactory.js +5 -9
- package/api/RepositoryFactory.js.map +1 -1
- package/api/Types.d.ts +0 -24
- package/api/Types.d.ts.map +1 -1
- package/api/Types.js +13 -62
- package/api/Types.js.map +1 -1
- package/auxiliary/AtomicBoolean.js +3 -6
- package/auxiliary/AtomicBoolean.js.map +1 -1
- package/auxiliary/AtomicBooleanFactory.js +5 -9
- package/auxiliary/AtomicBooleanFactory.js.map +1 -1
- package/auxiliary/AtomicInteger.js +3 -6
- package/auxiliary/AtomicInteger.js.map +1 -1
- package/auxiliary/AtomicIntegerFactory.js +5 -9
- package/auxiliary/AtomicIntegerFactory.js.map +1 -1
- package/auxiliary/AtomicReference.js +3 -6
- package/auxiliary/AtomicReference.js.map +1 -1
- package/auxiliary/AtomicReferenceFactory.js +5 -9
- package/auxiliary/AtomicReferenceFactory.js.map +1 -1
- package/auxiliary/Checks.js +23 -36
- package/auxiliary/Checks.js.map +1 -1
- package/auxiliary/Consumer.js +7 -12
- package/auxiliary/Consumer.js.map +1 -1
- package/auxiliary/Convenience.d.ts +10 -6
- package/auxiliary/Convenience.d.ts.map +1 -1
- package/auxiliary/Convenience.js +17 -19
- package/auxiliary/Convenience.js.map +1 -1
- package/auxiliary/IdempotenState.d.ts +1 -1
- package/auxiliary/IdempotenState.d.ts.map +1 -1
- package/auxiliary/IdempotenState.js +2 -5
- package/auxiliary/IdempotenState.js.map +1 -1
- package/auxiliary/Idempotent.js +3 -6
- package/auxiliary/Idempotent.js.map +1 -1
- package/auxiliary/IdempotentFactory.js +5 -9
- package/auxiliary/IdempotentFactory.js.map +1 -1
- package/auxiliary/IllegalArgumentException.js +4 -8
- package/auxiliary/IllegalArgumentException.js.map +1 -1
- package/auxiliary/IllegalStateException.js +4 -8
- package/auxiliary/IllegalStateException.js.map +1 -1
- package/auxiliary/Predicate.js +9 -15
- package/auxiliary/Predicate.js.map +1 -1
- package/auxiliary/Supplier.js +10 -16
- package/auxiliary/Supplier.js.map +1 -1
- package/auxiliary/Transform.js +11 -18
- package/auxiliary/Transform.js.map +1 -1
- package/auxiliary/Validate.js +12 -15
- package/auxiliary/Validate.js.map +1 -1
- package/impl/AtomicBoolean.impl.js +1 -4
- package/impl/AtomicBoolean.impl.js.map +1 -1
- package/impl/AtomicBooleanFactory.impl.js +3 -6
- package/impl/AtomicBooleanFactory.impl.js.map +1 -1
- package/impl/AtomicInteger.impl.js +1 -4
- package/impl/AtomicInteger.impl.js.map +1 -1
- package/impl/AtomicIntegerFactory.impl.js +3 -6
- package/impl/AtomicIntegerFactory.impl.js.map +1 -1
- package/impl/AtomicReference.impl.js +2 -7
- package/impl/AtomicReference.impl.js.map +1 -1
- package/impl/AtomicReferenceFactory.impl.js +3 -6
- package/impl/AtomicReferenceFactory.impl.js.map +1 -1
- package/impl/AutoCloseFactory.impl.d.ts +0 -3
- package/impl/AutoCloseFactory.impl.d.ts.map +1 -1
- package/impl/AutoCloseFactory.impl.js +7 -10
- package/impl/AutoCloseFactory.impl.js.map +1 -1
- package/impl/AutoCloseMany.impl.d.ts +0 -2
- package/impl/AutoCloseMany.impl.d.ts.map +1 -1
- package/impl/AutoCloseMany.impl.js +5 -8
- package/impl/AutoCloseMany.impl.js.map +1 -1
- package/impl/AutoCloseOne.impl.d.ts.map +1 -1
- package/impl/AutoCloseOne.impl.js +8 -11
- package/impl/AutoCloseOne.impl.js.map +1 -1
- package/impl/ContractFactory.impl.js +7 -11
- package/impl/ContractFactory.impl.js.map +1 -1
- package/impl/Contracts.impl.d.ts.map +1 -1
- package/impl/Contracts.impl.js +38 -41
- package/impl/Contracts.impl.js.map +1 -1
- package/impl/ContractsFactory.impl.js +28 -32
- package/impl/ContractsFactory.impl.js.map +1 -1
- package/impl/ContractsWrapper.impl.js +3 -6
- package/impl/ContractsWrapper.impl.js.map +1 -1
- package/impl/Events.d.ts +1 -2
- package/impl/Events.d.ts.map +1 -1
- package/impl/Events.impl.d.ts +1 -2
- package/impl/Events.impl.d.ts.map +1 -1
- package/impl/Events.impl.js +6 -9
- package/impl/Events.impl.js.map +1 -1
- package/impl/Events.js +1 -2
- package/impl/Events.js.map +1 -1
- package/impl/ExtractorPromisor.impl.d.ts +2 -1
- package/impl/ExtractorPromisor.impl.d.ts.map +1 -1
- package/impl/ExtractorPromisor.impl.js +6 -9
- package/impl/ExtractorPromisor.impl.js.map +1 -1
- package/impl/Idempotent.impl.js +10 -13
- package/impl/Idempotent.impl.js.map +1 -1
- package/impl/IdempotentFactory.impl.js +5 -8
- package/impl/IdempotentFactory.impl.js.map +1 -1
- package/impl/Internal.impl.js +5 -8
- package/impl/Internal.impl.js.map +1 -1
- package/impl/LifeCyclePromisor.impl.js +19 -22
- package/impl/LifeCyclePromisor.impl.js.map +1 -1
- package/impl/Policy.d.ts +0 -1
- package/impl/Policy.d.ts.map +1 -1
- package/impl/Policy.impl.d.ts +1 -3
- package/impl/Policy.impl.d.ts.map +1 -1
- package/impl/Policy.impl.js +7 -10
- package/impl/Policy.impl.js.map +1 -1
- package/impl/Policy.js +1 -2
- package/impl/PromisorFactory.impl.d.ts.map +1 -1
- package/impl/PromisorFactory.impl.js +11 -14
- package/impl/PromisorFactory.impl.js.map +1 -1
- package/impl/Repository.impl.d.ts.map +1 -1
- package/impl/Repository.impl.js +19 -22
- package/impl/Repository.impl.js.map +1 -1
- package/impl/RepositoryFactory.impl.js +3 -6
- package/impl/RepositoryFactory.impl.js.map +1 -1
- package/impl/SingletonPromisor.impl.js +7 -10
- package/impl/SingletonPromisor.impl.js.map +1 -1
- package/impl/Storage.impl.js +3 -7
- package/impl/Storage.impl.js.map +1 -1
- package/impl/ValuePromisor.impl.js +1 -4
- package/impl/ValuePromisor.impl.js.map +1 -1
- package/index.d.ts +8 -20
- package/index.d.ts.map +1 -1
- package/index.js +10 -38
- package/index.js.map +1 -1
- package/package.json +10 -14
- package/version.js +2 -5
- package/version.js.map +1 -1
- package/auxiliary/Functional.d.ts +0 -9
- package/auxiliary/Functional.d.ts.map +0 -1
- package/auxiliary/Functional.js +0 -23
- package/auxiliary/Functional.js.map +0 -1
package/api/Repository.js
CHANGED
|
@@ -1,15 +1,12 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
exports.guard = guard;
|
|
4
|
-
const Open_1 = require("@jonloucks/contracts-ts/api/Open");
|
|
5
|
-
const Types_1 = require("@jonloucks/contracts-ts/api/Types");
|
|
1
|
+
import { guard as openGuard } from "@jonloucks/contracts-ts/api/Open";
|
|
2
|
+
import { guardFunctions } from "@jonloucks/contracts-ts/api/Types";
|
|
6
3
|
/**
|
|
7
4
|
* Type guard for Repository
|
|
8
5
|
*
|
|
9
6
|
* @param value the value to check
|
|
10
7
|
* @return true if value is Repository, false otherwise
|
|
11
8
|
*/
|
|
12
|
-
function guard(value) {
|
|
13
|
-
return
|
|
9
|
+
export function guard(value) {
|
|
10
|
+
return guardFunctions(value, 'store', 'keep', 'check', 'require') && openGuard(value);
|
|
14
11
|
}
|
|
15
12
|
//# sourceMappingURL=Repository.js.map
|
package/api/Repository.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Repository.js","sourceRoot":"","sources":["../../src/api/Repository.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Repository.js","sourceRoot":"","sources":["../../src/api/Repository.ts"],"names":[],"mappings":"AACA,OAAO,EAAQ,KAAK,IAAI,SAAS,EAAE,MAAM,kCAAkC,CAAC;AAI5E,OAAO,EAAE,cAAc,EAAgB,MAAM,mCAAmC,CAAC;AAoEjF;;;;;GAKG;AACH,MAAM,UAAU,KAAK,CAAC,KAAc;IAClC,OAAO,cAAc,CAAC,KAAK,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,SAAS,CAAC,IAAI,SAAS,CAAC,KAAK,CAAC,CAAC;AACxF,CAAC"}
|
package/api/RepositoryFactory.js
CHANGED
|
@@ -1,22 +1,18 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
exports.CONTRACT = void 0;
|
|
4
|
-
exports.guard = guard;
|
|
5
|
-
const RatifiedContract_1 = require("@jonloucks/contracts-ts/api/RatifiedContract");
|
|
6
|
-
const Types_1 = require("@jonloucks/contracts-ts/api/Types");
|
|
1
|
+
import { create as createContract } from "@jonloucks/contracts-ts/api/RatifiedContract";
|
|
2
|
+
import { guardFunctions } from "@jonloucks/contracts-ts/api/Types";
|
|
7
3
|
/**
|
|
8
4
|
* Type guard for RepositoryFactory
|
|
9
5
|
*
|
|
10
6
|
* @param value the value to check
|
|
11
7
|
* @return true if value is RepositoryFactory, false otherwise
|
|
12
8
|
*/
|
|
13
|
-
function guard(value) {
|
|
14
|
-
return
|
|
9
|
+
export function guard(value) {
|
|
10
|
+
return guardFunctions(value, "createRepository");
|
|
15
11
|
}
|
|
16
12
|
/**
|
|
17
13
|
* The factory Contract for creating new Repository instances.
|
|
18
14
|
*/
|
|
19
|
-
|
|
15
|
+
export const CONTRACT = createContract({
|
|
20
16
|
test: guard,
|
|
21
17
|
name: "RepositoryFactory"
|
|
22
18
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RepositoryFactory.js","sourceRoot":"","sources":["../../src/api/RepositoryFactory.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"RepositoryFactory.js","sourceRoot":"","sources":["../../src/api/RepositoryFactory.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,IAAI,cAAc,EAAE,MAAM,8CAA8C,CAAC;AAExF,OAAO,EAAgB,cAAc,EAAE,MAAM,mCAAmC,CAAC;AAajF;;;;;GAKG;AACH,MAAM,UAAU,KAAK,CAAC,KAAc;IAClC,OAAO,cAAc,CAAC,KAAK,EAAE,kBAAkB,CAAC,CAAC;AACnD,CAAC;AAED;;GAEG;AACH,MAAM,CAAC,MAAM,QAAQ,GAA8C,cAAc,CAAC;IAChF,IAAI,EAAE,KAAK;IACX,IAAI,EAAE,mBAAmB;CAC1B,CAAC,CAAC"}
|
package/api/Types.d.ts
CHANGED
|
@@ -17,22 +17,6 @@ export type UndefinedType<T> = T | undefined;
|
|
|
17
17
|
* A function of unknown signature
|
|
18
18
|
*/
|
|
19
19
|
export type UnknownFunction = (...args: unknown[]) => unknown;
|
|
20
|
-
/**
|
|
21
|
-
* A transformation from type I to type O
|
|
22
|
-
*/
|
|
23
|
-
export interface Transform<I, O> {
|
|
24
|
-
transform(input: I): O;
|
|
25
|
-
}
|
|
26
|
-
/**
|
|
27
|
-
* A function that transforms type I to type O
|
|
28
|
-
* @deprecated use @jonloucks/contracts-ts/auxiliary/Functional instead
|
|
29
|
-
*/
|
|
30
|
-
export type TransformFunction<I, O> = (input: I) => O;
|
|
31
|
-
/**
|
|
32
|
-
* A transformation type that can be a Transform or a function from type I to type O
|
|
33
|
-
* @deprecated use @jonloucks/contracts-ts/auxiliary/Functional instead
|
|
34
|
-
*/
|
|
35
|
-
export type TransformType<I, O> = Transform<I, O> | TransformFunction<I, O>;
|
|
36
20
|
/**
|
|
37
21
|
* Check iif given value is not null or undefined
|
|
38
22
|
*
|
|
@@ -122,12 +106,4 @@ export declare function guardFunctions<T>(value: unknown, ...propertyNames: (str
|
|
|
122
106
|
* @returns true if property is defined as a function or getter/setter, false otherwise
|
|
123
107
|
*/
|
|
124
108
|
export declare function hasFunction<T>(value: unknown, propertyName: string | symbol): value is RequiredType<T & object>;
|
|
125
|
-
/**
|
|
126
|
-
* Convert a TransformType to a Transform
|
|
127
|
-
*
|
|
128
|
-
* @param transform the TransformType to convert
|
|
129
|
-
* @returns the Transform
|
|
130
|
-
* @deprecated use @jonloucks/contracts-ts/auxiliary/Functional instead
|
|
131
|
-
*/
|
|
132
|
-
export declare function typeToTransform<I, O>(transform: TransformType<I, O>): RequiredType<Transform<I, O>>;
|
|
133
109
|
//# sourceMappingURL=Types.d.ts.map
|
package/api/Types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Types.d.ts","sourceRoot":"","sources":["../../src/api/Types.ts"],"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AAQ,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,YAAY,CAAC,MAAM,CAAC,CAEtE;AAED;;;;GAIG;AACH,wBAAgB,QAAQ,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,YAAY,CAAC,MAAM,CAAC,CAEtE;AAED;;;;GAIG;AACH,wBAAgB,SAAS,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,YAAY,CAAC,OAAO,CAAC,CAExE;AAED;;;;GAIG;AACH,wBAAgB,QAAQ,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,YAAY,CAAC,MAAM,CAAC,CAEtE;AAED;;;;GAIG;AACH,wBAAgB,aAAa,CAAC,CAAC,EAAE,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,YAAY,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,CAErF;AAED;;;;;;;GAOG;AACH,wBAAgB,cAAc,CAAC,CAAC,EAAE,KAAK,EAAE,OAAO,EAAE,GAAG,aAAa,EAAE,CAAC,MAAM,GAAG,MAAM,CAAC,EAAE,GAAG,KAAK,IAAI,YAAY,CAAC,CAAC,GAAG,MAAM,CAAC,CAY1H;AAED;;;;;;;GAOG;AACH,wBAAgB,WAAW,CAAC,CAAC,EAAE,KAAK,EAAE,OAAO,EAAE,YAAY,EAAE,MAAM,GAAG,MAAM,GAAG,KAAK,IAAI,YAAY,CAAC,CAAC,GAAG,MAAM,CAAC,CAY/G"}
|
package/api/Types.js
CHANGED
|
@@ -1,31 +1,13 @@
|
|
|
1
|
-
"use strict";
|
|
2
1
|
/**
|
|
3
2
|
* Types and type guards for API
|
|
4
3
|
*/
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.isPresent = isPresent;
|
|
7
|
-
exports.isNotPresent = isNotPresent;
|
|
8
|
-
exports.isFunction = isFunction;
|
|
9
|
-
exports.isFunctionWithArity = isFunctionWithArity;
|
|
10
|
-
exports.isObject = isObject;
|
|
11
|
-
exports.isString = isString;
|
|
12
|
-
exports.isNumber = isNumber;
|
|
13
|
-
exports.isSymbol = isSymbol;
|
|
14
|
-
exports.isBoolean = isBoolean;
|
|
15
|
-
exports.isBigInt = isBigInt;
|
|
16
|
-
exports.isConstructor = isConstructor;
|
|
17
|
-
exports.guardFunctions = guardFunctions;
|
|
18
|
-
exports.hasFunction = hasFunction;
|
|
19
|
-
exports.typeToTransform = typeToTransform;
|
|
20
|
-
const Checks_1 = require("@jonloucks/contracts-ts/auxiliary/Checks");
|
|
21
|
-
const IllegalArgumentException_1 = require("@jonloucks/contracts-ts/auxiliary/IllegalArgumentException");
|
|
22
4
|
/**
|
|
23
5
|
* Check iif given value is not null or undefined
|
|
24
6
|
*
|
|
25
7
|
* @param value the value to check
|
|
26
8
|
* @returns true iif value is not null or undefined, false for actual values
|
|
27
9
|
*/
|
|
28
|
-
function isPresent(value) {
|
|
10
|
+
export function isPresent(value) {
|
|
29
11
|
return value !== null && value !== undefined;
|
|
30
12
|
}
|
|
31
13
|
/**
|
|
@@ -34,7 +16,7 @@ function isPresent(value) {
|
|
|
34
16
|
* @param value the value to check
|
|
35
17
|
* @returns true iif value is null or undefined, false for actual values
|
|
36
18
|
*/
|
|
37
|
-
function isNotPresent(value) {
|
|
19
|
+
export function isNotPresent(value) {
|
|
38
20
|
return value === null || value === undefined;
|
|
39
21
|
}
|
|
40
22
|
/**
|
|
@@ -42,7 +24,7 @@ function isNotPresent(value) {
|
|
|
42
24
|
* @param value the value to check
|
|
43
25
|
* @returns true if value is a function and is not null or undefined
|
|
44
26
|
*/
|
|
45
|
-
function isFunction(value) {
|
|
27
|
+
export function isFunction(value) {
|
|
46
28
|
return isPresent(value) && typeof value === "function";
|
|
47
29
|
}
|
|
48
30
|
/**
|
|
@@ -52,7 +34,7 @@ function isFunction(value) {
|
|
|
52
34
|
* @param arity the arity to check
|
|
53
35
|
* @returns true if value is a function with the given arity
|
|
54
36
|
*/
|
|
55
|
-
function isFunctionWithArity(value, arity) {
|
|
37
|
+
export function isFunctionWithArity(value, arity) {
|
|
56
38
|
return isFunction(value) && value.length === arity;
|
|
57
39
|
}
|
|
58
40
|
/**
|
|
@@ -60,7 +42,7 @@ function isFunctionWithArity(value, arity) {
|
|
|
60
42
|
* @param value the value to check
|
|
61
43
|
* @returns true if value is an object and is not null or undefined
|
|
62
44
|
*/
|
|
63
|
-
function isObject(value) {
|
|
45
|
+
export function isObject(value) {
|
|
64
46
|
return isPresent(value) && typeof value === "object";
|
|
65
47
|
}
|
|
66
48
|
/**
|
|
@@ -69,7 +51,7 @@ function isObject(value) {
|
|
|
69
51
|
* @param value the value to check
|
|
70
52
|
* @returns true if value is a string
|
|
71
53
|
*/
|
|
72
|
-
function isString(value) {
|
|
54
|
+
export function isString(value) {
|
|
73
55
|
return isPresent(value) && typeof value === "string";
|
|
74
56
|
}
|
|
75
57
|
/**
|
|
@@ -77,7 +59,7 @@ function isString(value) {
|
|
|
77
59
|
* @param value the value to check
|
|
78
60
|
* @returns true if value is a number and is not null or undefined
|
|
79
61
|
*/
|
|
80
|
-
function isNumber(value) {
|
|
62
|
+
export function isNumber(value) {
|
|
81
63
|
return isPresent(value) && typeof value === "number";
|
|
82
64
|
}
|
|
83
65
|
/**
|
|
@@ -85,7 +67,7 @@ function isNumber(value) {
|
|
|
85
67
|
* @param value the value to check
|
|
86
68
|
* @returns true if value is a symbol and is not null or undefined
|
|
87
69
|
*/
|
|
88
|
-
function isSymbol(value) {
|
|
70
|
+
export function isSymbol(value) {
|
|
89
71
|
return isPresent(value) && typeof value === "symbol";
|
|
90
72
|
}
|
|
91
73
|
/**
|
|
@@ -93,7 +75,7 @@ function isSymbol(value) {
|
|
|
93
75
|
* @param value the value to check
|
|
94
76
|
* @returns true if value is a boolean and is not null or undefined
|
|
95
77
|
*/
|
|
96
|
-
function isBoolean(value) {
|
|
78
|
+
export function isBoolean(value) {
|
|
97
79
|
return isPresent(value) && typeof value === "boolean";
|
|
98
80
|
}
|
|
99
81
|
/**
|
|
@@ -101,7 +83,7 @@ function isBoolean(value) {
|
|
|
101
83
|
* @param value the value to check
|
|
102
84
|
* @returns true if value is a bigint and is not null or undefined
|
|
103
85
|
*/
|
|
104
|
-
function isBigInt(value) {
|
|
86
|
+
export function isBigInt(value) {
|
|
105
87
|
return isPresent(value) && typeof value === "bigint";
|
|
106
88
|
}
|
|
107
89
|
/**
|
|
@@ -109,7 +91,7 @@ function isBigInt(value) {
|
|
|
109
91
|
* @param value the value to check
|
|
110
92
|
* @returns true if value is a constructor and is not null or undefined
|
|
111
93
|
*/
|
|
112
|
-
function isConstructor(value) {
|
|
94
|
+
export function isConstructor(value) {
|
|
113
95
|
return isFunction(value) && 'prototype' in value && 'constructor' in value;
|
|
114
96
|
}
|
|
115
97
|
/**
|
|
@@ -120,7 +102,7 @@ function isConstructor(value) {
|
|
|
120
102
|
* @param propertyNames the property names to check
|
|
121
103
|
* @returns true if property is defined
|
|
122
104
|
*/
|
|
123
|
-
function guardFunctions(value, ...propertyNames) {
|
|
105
|
+
export function guardFunctions(value, ...propertyNames) {
|
|
124
106
|
if (isObject(value) === false) {
|
|
125
107
|
return false;
|
|
126
108
|
}
|
|
@@ -139,7 +121,7 @@ function guardFunctions(value, ...propertyNames) {
|
|
|
139
121
|
* @param propertyName the property name to check
|
|
140
122
|
* @returns true if property is defined as a function or getter/setter, false otherwise
|
|
141
123
|
*/
|
|
142
|
-
function hasFunction(value, propertyName) {
|
|
124
|
+
export function hasFunction(value, propertyName) {
|
|
143
125
|
const descriptor = getPropertyDescriptor(value, propertyName);
|
|
144
126
|
if (isNotPresent(descriptor)) {
|
|
145
127
|
return false;
|
|
@@ -163,35 +145,4 @@ function getPropertyDescriptor(instance, name) {
|
|
|
163
145
|
}
|
|
164
146
|
return undefined;
|
|
165
147
|
}
|
|
166
|
-
/**
|
|
167
|
-
* @deprecated use @jonloucks/contracts-ts/auxiliary/Functional instead
|
|
168
|
-
*/
|
|
169
|
-
function guardTransform(transform) {
|
|
170
|
-
return guardFunctions(transform, 'transform');
|
|
171
|
-
}
|
|
172
|
-
/**
|
|
173
|
-
* @deprecated use @jonloucks/contracts-ts/auxiliary/Functional instead
|
|
174
|
-
*/
|
|
175
|
-
function guardTransformFunction(transform) {
|
|
176
|
-
return isFunctionWithArity(transform, 1);
|
|
177
|
-
}
|
|
178
|
-
/**
|
|
179
|
-
* Convert a TransformType to a Transform
|
|
180
|
-
*
|
|
181
|
-
* @param transform the TransformType to convert
|
|
182
|
-
* @returns the Transform
|
|
183
|
-
* @deprecated use @jonloucks/contracts-ts/auxiliary/Functional instead
|
|
184
|
-
*/
|
|
185
|
-
function typeToTransform(transform) {
|
|
186
|
-
const validTransformType = (0, Checks_1.presentCheck)(transform, "TransformType must be present.");
|
|
187
|
-
if (guardTransform(validTransformType)) {
|
|
188
|
-
return validTransformType;
|
|
189
|
-
}
|
|
190
|
-
else if (guardTransformFunction(validTransformType)) {
|
|
191
|
-
return { transform: validTransformType };
|
|
192
|
-
}
|
|
193
|
-
else {
|
|
194
|
-
throw new IllegalArgumentException_1.IllegalArgumentException("TransformType must be a Transform or a function taking one argument.");
|
|
195
|
-
}
|
|
196
|
-
}
|
|
197
148
|
//# sourceMappingURL=Types.js.map
|
package/api/Types.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Types.js","sourceRoot":"","sources":["../../src/api/Types.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Types.js","sourceRoot":"","sources":["../../src/api/Types.ts"],"names":[],"mappings":"AAAA;;GAEG;AAsBH;;;;;GAKG;AACH,MAAM,UAAU,SAAS,CAAI,KAAc;IACzC,OAAO,KAAK,KAAK,IAAI,IAAI,KAAK,KAAK,SAAS,CAAC;AAC/C,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,YAAY,CAAC,KAAc;IACzC,OAAO,KAAK,KAAK,IAAI,IAAI,KAAK,KAAK,SAAS,CAAC;AAC/C,CAAC;AAED;;;;GAIG;AACH,MAAM,UAA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C,cAAc,CAAC,KAAK,CAAC,CAAC;IACvC,CAAC;IACD,OAAO,SAAS,CAAC;AACnB,CAAC"}
|
|
@@ -1,14 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.guard = guard;
|
|
4
|
-
const Types_1 = require("@jonloucks/contracts-ts/api/Types");
|
|
1
|
+
import { guardFunctions } from "@jonloucks/contracts-ts/api/Types";
|
|
5
2
|
/**
|
|
6
3
|
* Type guard for AtomicBoolean interface.
|
|
7
4
|
*
|
|
8
5
|
* @param instance the instance to check
|
|
9
6
|
* @returns true if the instance implements AtomicBoolean
|
|
10
7
|
*/
|
|
11
|
-
function guard(instance) {
|
|
12
|
-
return
|
|
8
|
+
export function guard(instance) {
|
|
9
|
+
return guardFunctions(instance, "compareAndSet", "get", "set", "getAndSet");
|
|
13
10
|
}
|
|
14
11
|
//# sourceMappingURL=AtomicBoolean.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AtomicBoolean.js","sourceRoot":"","sources":["../../src/auxiliary/AtomicBoolean.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"AtomicBoolean.js","sourceRoot":"","sources":["../../src/auxiliary/AtomicBoolean.ts"],"names":[],"mappings":"AAAA,OAAO,EAAgB,cAAc,EAAE,MAAM,mCAAmC,CAAC;AA0CjF;;;;;GAKG;AACH,MAAM,UAAU,KAAK,CAAC,QAAiB;IACnC,OAAO,cAAc,CAAC,QAAQ,EAAE,eAAe,EAAE,KAAK,EAAE,KAAK,EAAE,WAAW,CAAC,CAAC;AAChF,CAAC"}
|
|
@@ -1,22 +1,18 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
exports.CONTRACT = void 0;
|
|
4
|
-
exports.guard = guard;
|
|
5
|
-
const RatifiedContract_1 = require("@jonloucks/contracts-ts/api/RatifiedContract");
|
|
6
|
-
const Types_1 = require("@jonloucks/contracts-ts/api/Types");
|
|
1
|
+
import { create as createContract } from "@jonloucks/contracts-ts/api/RatifiedContract";
|
|
2
|
+
import { guardFunctions } from "@jonloucks/contracts-ts/api/Types";
|
|
7
3
|
/**
|
|
8
4
|
* Type guard for AtomicBooleanFactory interface.
|
|
9
5
|
*
|
|
10
6
|
* @param instance the instance to check
|
|
11
7
|
* @returns true if the instance implements AtomicBooleanFactory
|
|
12
8
|
*/
|
|
13
|
-
function guard(instance) {
|
|
14
|
-
return
|
|
9
|
+
export function guard(instance) {
|
|
10
|
+
return guardFunctions(instance, "createAtomicBoolean");
|
|
15
11
|
}
|
|
16
12
|
/**
|
|
17
13
|
* The factory Contract for creating new AtomicBoolean instances.
|
|
18
14
|
*/
|
|
19
|
-
|
|
15
|
+
export const CONTRACT = createContract({
|
|
20
16
|
test: guard,
|
|
21
17
|
name: "AtomicBooleanFactory"
|
|
22
18
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AtomicBooleanFactory.js","sourceRoot":"","sources":["../../src/auxiliary/AtomicBooleanFactory.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"AtomicBooleanFactory.js","sourceRoot":"","sources":["../../src/auxiliary/AtomicBooleanFactory.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,IAAI,cAAc,EAAE,MAAM,8CAA8C,CAAC;AACxF,OAAO,EAAgB,cAAc,EAAE,MAAM,mCAAmC,CAAC;AAejF;;;;;GAKG;AACH,MAAM,UAAU,KAAK,CAAC,QAAiB;IACrC,OAAO,cAAc,CAAC,QAAQ,EAAE,qBAAqB,CAAC,CAAC;AACzD,CAAC;AAED;;GAEG;AACH,MAAM,CAAC,MAAM,QAAQ,GAAmC,cAAc,CAAC;IACrE,IAAI,EAAE,KAAK;IACX,IAAI,EAAE,sBAAsB;CAC7B,CAAC,CAAC"}
|
|
@@ -1,14 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.guard = guard;
|
|
4
|
-
const Types_1 = require("@jonloucks/contracts-ts/api/Types");
|
|
1
|
+
import { guardFunctions } from "@jonloucks/contracts-ts/api/Types";
|
|
5
2
|
/**
|
|
6
3
|
* Type guard for AtomicInteger interface.
|
|
7
4
|
*
|
|
8
5
|
* @param instance the instance to check
|
|
9
6
|
* @returns true if the instance implements AtomicInteger
|
|
10
7
|
*/
|
|
11
|
-
function guard(instance) {
|
|
12
|
-
return
|
|
8
|
+
export function guard(instance) {
|
|
9
|
+
return guardFunctions(instance, "compareAndSet", "incrementAndGet", "decrementAndGet", "getAndSet", "get", "set");
|
|
13
10
|
}
|
|
14
11
|
//# sourceMappingURL=AtomicInteger.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AtomicInteger.js","sourceRoot":"","sources":["../../src/auxiliary/AtomicInteger.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"AtomicInteger.js","sourceRoot":"","sources":["../../src/auxiliary/AtomicInteger.ts"],"names":[],"mappings":"AAAA,OAAO,EAAgB,cAAc,EAAE,MAAM,mCAAmC,CAAC;AAqDjF;;;;;GAKG;AACH,MAAM,UAAU,KAAK,CAAC,QAAiB;IACnC,OAAO,cAAc,CAAC,QAAQ,EAAE,eAAe,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,WAAW,EAAE,KAAK,EAAE,KAAK,CAAC,CAAC;AACtH,CAAC"}
|
|
@@ -1,22 +1,18 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
exports.CONTRACT = void 0;
|
|
4
|
-
exports.guard = guard;
|
|
5
|
-
const RatifiedContract_1 = require("@jonloucks/contracts-ts/api/RatifiedContract");
|
|
6
|
-
const Types_1 = require("@jonloucks/contracts-ts/api/Types");
|
|
1
|
+
import { create as createContract } from "@jonloucks/contracts-ts/api/RatifiedContract";
|
|
2
|
+
import { guardFunctions } from "@jonloucks/contracts-ts/api/Types";
|
|
7
3
|
/**
|
|
8
4
|
* Type guard for AtomicIntegerFactory interface.
|
|
9
5
|
*
|
|
10
6
|
* @param instance the instance to check
|
|
11
7
|
* @returns true if the instance implements AtomicIntegerFactory
|
|
12
8
|
*/
|
|
13
|
-
function guard(instance) {
|
|
14
|
-
return
|
|
9
|
+
export function guard(instance) {
|
|
10
|
+
return guardFunctions(instance, 'createAtomicInteger');
|
|
15
11
|
}
|
|
16
12
|
/**
|
|
17
13
|
* The factory Contract for creating new AtomicInteger instances.
|
|
18
14
|
*/
|
|
19
|
-
|
|
15
|
+
export const CONTRACT = createContract({
|
|
20
16
|
test: guard,
|
|
21
17
|
name: "AtomicIntegerFactory"
|
|
22
18
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AtomicIntegerFactory.js","sourceRoot":"","sources":["../../src/auxiliary/AtomicIntegerFactory.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"AtomicIntegerFactory.js","sourceRoot":"","sources":["../../src/auxiliary/AtomicIntegerFactory.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,IAAI,cAAc,EAAE,MAAM,8CAA8C,CAAC;AACxF,OAAO,EAAgB,cAAc,EAAE,MAAM,mCAAmC,CAAC;AAejF;;;;;GAKG;AACH,MAAM,UAAU,KAAK,CAAC,QAAiB;IACnC,OAAO,cAAc,CAAC,QAAQ,EAAE,qBAAqB,CAAC,CAAC;AAC3D,CAAC;AAED;;GAEG;AACH,MAAM,CAAC,MAAM,QAAQ,GAAmC,cAAc,CAAC;IACnE,IAAI,EAAE,KAAK;IACX,IAAI,EAAE,sBAAsB;CAC/B,CAAC,CAAC"}
|
|
@@ -1,14 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.guard = guard;
|
|
4
|
-
const Types_1 = require("@jonloucks/contracts-ts/api/Types");
|
|
1
|
+
import { guardFunctions } from "@jonloucks/contracts-ts/api/Types";
|
|
5
2
|
/**
|
|
6
3
|
* Type guard for AtomicReference interface.
|
|
7
4
|
*
|
|
8
5
|
* @param instance the instance to check
|
|
9
6
|
* @returns true if the instance implements AtomicReference
|
|
10
7
|
*/
|
|
11
|
-
function guard(instance) {
|
|
12
|
-
return
|
|
8
|
+
export function guard(instance) {
|
|
9
|
+
return guardFunctions(instance, "compareAndSet", "getAndSet", "get", "set");
|
|
13
10
|
}
|
|
14
11
|
//# sourceMappingURL=AtomicReference.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AtomicReference.js","sourceRoot":"","sources":["../../src/auxiliary/AtomicReference.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"AtomicReference.js","sourceRoot":"","sources":["../../src/auxiliary/AtomicReference.ts"],"names":[],"mappings":"AAAA,OAAO,EAA8B,cAAc,EAAE,MAAM,mCAAmC,CAAC;AA4C/F;;;;;GAKG;AACH,MAAM,UAAU,KAAK,CAAI,QAAiB;IACtC,OAAO,cAAc,CAAC,QAAQ,EAAE,eAAe,EAAE,WAAW,EAAE,KAAK,EAAE,KAAK,CAAC,CAAC;AAChF,CAAC"}
|
|
@@ -1,22 +1,18 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
exports.CONTRACT = void 0;
|
|
4
|
-
exports.guard = guard;
|
|
5
|
-
const RatifiedContract_1 = require("@jonloucks/contracts-ts/api/RatifiedContract");
|
|
6
|
-
const Types_1 = require("@jonloucks/contracts-ts/api/Types");
|
|
1
|
+
import { create as createContract } from "@jonloucks/contracts-ts/api/RatifiedContract";
|
|
2
|
+
import { guardFunctions } from "@jonloucks/contracts-ts/api/Types";
|
|
7
3
|
/**
|
|
8
4
|
* Type guard for AtomicReferenceFactory interface.
|
|
9
5
|
*
|
|
10
6
|
* @param instance the instance to check
|
|
11
7
|
* @returns true if the instance implements AtomicReferenceFactory
|
|
12
8
|
*/
|
|
13
|
-
function guard(instance) {
|
|
14
|
-
return
|
|
9
|
+
export function guard(instance) {
|
|
10
|
+
return guardFunctions(instance, "createAtomicReference");
|
|
15
11
|
}
|
|
16
12
|
/**
|
|
17
13
|
* The factory Contract for creating new AtomicReference instances.
|
|
18
14
|
*/
|
|
19
|
-
|
|
15
|
+
export const CONTRACT = createContract({
|
|
20
16
|
test: guard,
|
|
21
17
|
name: "AtomicReferenceFactory"
|
|
22
18
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AtomicReferenceFactory.js","sourceRoot":"","sources":["../../src/auxiliary/AtomicReferenceFactory.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"AtomicReferenceFactory.js","sourceRoot":"","sources":["../../src/auxiliary/AtomicReferenceFactory.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,IAAI,cAAc,EAAE,MAAM,8CAA8C,CAAC;AACxF,OAAO,EAA8B,cAAc,EAAE,MAAM,mCAAmC,CAAC;AAe/F;;;;;GAKG;AACH,MAAM,UAAU,KAAK,CAAC,QAAiB;IACnC,OAAO,cAAc,CAAC,QAAQ,EAAE,uBAAuB,CAAC,CAAC;AAC7D,CAAC;AAED;;GAEG;AACH,MAAM,CAAC,MAAM,QAAQ,GAAqC,cAAc,CAAC;IACrE,IAAI,EAAE,KAAK;IACX,IAAI,EAAE,wBAAwB;CACjC,CAAC,CAAC"}
|
package/auxiliary/Checks.js
CHANGED
|
@@ -1,8 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
exports.used = exports.illegalCheck = exports.presentCheck = exports.messageCheck = exports.nameCheck = exports.typeCheck = exports.configCheck = exports.promisorCheck = exports.contractsCheck = exports.contractCheck = void 0;
|
|
4
|
-
const Types_1 = require("@jonloucks/contracts-ts/api/Types");
|
|
5
|
-
const IllegalArgumentException_1 = require("@jonloucks/contracts-ts/auxiliary/IllegalArgumentException");
|
|
1
|
+
import { isNotPresent } from "@jonloucks/contracts-ts/api/Types";
|
|
2
|
+
import { IllegalArgumentException } from "@jonloucks/contracts-ts/auxiliary/IllegalArgumentException";
|
|
6
3
|
/**
|
|
7
4
|
* Check if given Contract is not null or invalid
|
|
8
5
|
*
|
|
@@ -11,19 +8,17 @@ const IllegalArgumentException_1 = require("@jonloucks/contracts-ts/auxiliary/Il
|
|
|
11
8
|
* @return a valid contract
|
|
12
9
|
* @throws IllegalArgumentException when invalid
|
|
13
10
|
*/
|
|
14
|
-
const contractCheck = (contract) => {
|
|
15
|
-
return
|
|
11
|
+
export const contractCheck = (contract) => {
|
|
12
|
+
return presentCheck(contract, "Contract must be present.");
|
|
16
13
|
};
|
|
17
|
-
exports.contractCheck = contractCheck;
|
|
18
14
|
/**
|
|
19
15
|
* Check if given Contracts is not null or invalid
|
|
20
16
|
* @param contracts the Contracts to check
|
|
21
17
|
* @return a valid Contracts
|
|
22
18
|
*/
|
|
23
|
-
const contractsCheck = (contracts) => {
|
|
24
|
-
return
|
|
19
|
+
export const contractsCheck = (contracts) => {
|
|
20
|
+
return presentCheck(contracts, "Contracts must be present.");
|
|
25
21
|
};
|
|
26
|
-
exports.contractsCheck = contractsCheck;
|
|
27
22
|
/**
|
|
28
23
|
* Check if given Promisor is not null or invalid
|
|
29
24
|
*
|
|
@@ -32,10 +27,9 @@ exports.contractsCheck = contractsCheck;
|
|
|
32
27
|
* @return a valid promisor
|
|
33
28
|
* @throws IllegalArgumentException when invalid
|
|
34
29
|
*/
|
|
35
|
-
const promisorCheck = (promisor) => {
|
|
36
|
-
return
|
|
30
|
+
export const promisorCheck = (promisor) => {
|
|
31
|
+
return presentCheck(promisor, "Promisor must be present.");
|
|
37
32
|
};
|
|
38
|
-
exports.promisorCheck = promisorCheck;
|
|
39
33
|
/**
|
|
40
34
|
* Check if given config is not null or invalid
|
|
41
35
|
*
|
|
@@ -44,40 +38,36 @@ exports.promisorCheck = promisorCheck;
|
|
|
44
38
|
* @return a valid config
|
|
45
39
|
* @throws IllegalArgumentException when invalid
|
|
46
40
|
*/
|
|
47
|
-
const configCheck = (config) => {
|
|
48
|
-
return
|
|
41
|
+
export const configCheck = (config) => {
|
|
42
|
+
return presentCheck(config, "Config must be present.");
|
|
49
43
|
};
|
|
50
|
-
exports.configCheck = configCheck;
|
|
51
44
|
/**
|
|
52
45
|
* Check if given type is not null or invalid
|
|
53
46
|
*
|
|
54
47
|
* @param {*} type the type to check
|
|
55
48
|
* @returns a valid type
|
|
56
49
|
*/
|
|
57
|
-
const typeCheck = (name) => {
|
|
58
|
-
return
|
|
50
|
+
export const typeCheck = (name) => {
|
|
51
|
+
return presentCheck(name, "Type must be present.");
|
|
59
52
|
};
|
|
60
|
-
exports.typeCheck = typeCheck;
|
|
61
53
|
/**
|
|
62
54
|
* Check if given name is not null or invalid
|
|
63
55
|
*
|
|
64
56
|
* @param {*} name the name to check
|
|
65
57
|
* @returns a valid name
|
|
66
58
|
*/
|
|
67
|
-
const nameCheck = (name) => {
|
|
68
|
-
return
|
|
59
|
+
export const nameCheck = (name) => {
|
|
60
|
+
return presentCheck(name, "Name must be present.");
|
|
69
61
|
};
|
|
70
|
-
exports.nameCheck = nameCheck;
|
|
71
62
|
/**
|
|
72
63
|
* Check if given message is not null or invalid
|
|
73
64
|
*
|
|
74
65
|
* @param {*} value the message to check
|
|
75
66
|
* @returns a valid message
|
|
76
67
|
*/
|
|
77
|
-
const messageCheck = (value) => {
|
|
78
|
-
return
|
|
68
|
+
export const messageCheck = (value) => {
|
|
69
|
+
return presentCheck(value, "Message must be present.");
|
|
79
70
|
};
|
|
80
|
-
exports.messageCheck = messageCheck;
|
|
81
71
|
/**
|
|
82
72
|
* Check if given instance is not null
|
|
83
73
|
*
|
|
@@ -85,10 +75,9 @@ exports.messageCheck = messageCheck;
|
|
|
85
75
|
* @param {*} message the message used if an exception is thrown
|
|
86
76
|
* @returns the value passed
|
|
87
77
|
*/
|
|
88
|
-
const presentCheck = (value, message) => {
|
|
89
|
-
return
|
|
78
|
+
export const presentCheck = (value, message) => {
|
|
79
|
+
return illegalCheck(value, isNotPresent(value), message);
|
|
90
80
|
};
|
|
91
|
-
exports.presentCheck = presentCheck;
|
|
92
81
|
/**
|
|
93
82
|
* Check if given instance is not null
|
|
94
83
|
*
|
|
@@ -97,16 +86,15 @@ exports.presentCheck = presentCheck;
|
|
|
97
86
|
* @param {*} message the message used if an exception is thrown
|
|
98
87
|
* @returns the value passed in
|
|
99
88
|
*/
|
|
100
|
-
const illegalCheck = (value, failed, message) => {
|
|
101
|
-
if (
|
|
102
|
-
throw new
|
|
89
|
+
export const illegalCheck = (value, failed, message) => {
|
|
90
|
+
if (isNotPresent(message)) {
|
|
91
|
+
throw new IllegalArgumentException("Message for illegal check must be present.");
|
|
103
92
|
}
|
|
104
93
|
if (failed) {
|
|
105
|
-
throw new
|
|
94
|
+
throw new IllegalArgumentException(message);
|
|
106
95
|
}
|
|
107
96
|
return value;
|
|
108
97
|
};
|
|
109
|
-
exports.illegalCheck = illegalCheck;
|
|
110
98
|
/**
|
|
111
99
|
* explicity mark a value as used to avoid compiler warnings
|
|
112
100
|
* useful for "using" variable which are used for disposal or other side-effects
|
|
@@ -114,6 +102,5 @@ exports.illegalCheck = illegalCheck;
|
|
|
114
102
|
*
|
|
115
103
|
* @param value the value which you wish to declare as used
|
|
116
104
|
*/
|
|
117
|
-
const used = (value) => { void value; };
|
|
118
|
-
exports.used = used;
|
|
105
|
+
export const used = (value) => { void value; };
|
|
119
106
|
//# sourceMappingURL=Checks.js.map
|
package/auxiliary/Checks.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Checks.js","sourceRoot":"","sources":["../../src/auxiliary/Checks.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Checks.js","sourceRoot":"","sources":["../../src/auxiliary/Checks.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAA8B,MAAM,mCAAmC,CAAC;AAC7F,OAAO,EAAE,wBAAwB,EAAE,MAAM,4DAA4D,CAAC;AAEtG;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,aAAa,GAEtB,CAAI,QAAyB,EAAE,EAAE;IACjC,OAAO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