@apipass/common 0.0.17-alpha.0 → 0.0.18-alpha.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/lib/environment/either.d.ts +16 -0
- package/lib/environment/either.js +35 -0
- package/lib/environment/either.js.map +1 -0
- package/lib/index.d.ts +1 -0
- package/lib/index.js +1 -0
- package/lib/index.js.map +1 -1
- package/package.json +2 -2
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
declare type Either<S, F> = Success<S, F> | Failure<S, F>;
|
|
2
|
+
export declare class Success<S, F> {
|
|
3
|
+
readonly value: S;
|
|
4
|
+
constructor(value: S);
|
|
5
|
+
isSuccess(): this is Success<S, F>;
|
|
6
|
+
isFailure(): this is Failure<S, F>;
|
|
7
|
+
}
|
|
8
|
+
declare class Failure<S, F> {
|
|
9
|
+
readonly value: F;
|
|
10
|
+
constructor(value: F);
|
|
11
|
+
isSuccess(): this is Success<S, F>;
|
|
12
|
+
isFailure(): this is Failure<S, F>;
|
|
13
|
+
}
|
|
14
|
+
export declare const success: <S, F>(l: S) => Either<S, F>;
|
|
15
|
+
export declare const failure: <S, F>(a: F) => Either<S, F>;
|
|
16
|
+
export {};
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.failure = exports.success = exports.Success = void 0;
|
|
4
|
+
class Success {
|
|
5
|
+
constructor(value) {
|
|
6
|
+
this.value = value;
|
|
7
|
+
}
|
|
8
|
+
isSuccess() {
|
|
9
|
+
return true;
|
|
10
|
+
}
|
|
11
|
+
isFailure() {
|
|
12
|
+
return false;
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
exports.Success = Success;
|
|
16
|
+
class Failure {
|
|
17
|
+
constructor(value) {
|
|
18
|
+
this.value = value;
|
|
19
|
+
}
|
|
20
|
+
isSuccess() {
|
|
21
|
+
return false;
|
|
22
|
+
}
|
|
23
|
+
isFailure() {
|
|
24
|
+
return true;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
const success = (l) => {
|
|
28
|
+
return new Success(l);
|
|
29
|
+
};
|
|
30
|
+
exports.success = success;
|
|
31
|
+
const failure = (a) => {
|
|
32
|
+
return new Failure(a);
|
|
33
|
+
};
|
|
34
|
+
exports.failure = failure;
|
|
35
|
+
//# sourceMappingURL=either.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"either.js","sourceRoot":"","sources":["../../src/environment/either.ts"],"names":[],"mappings":";;;AAEA,MAAa,OAAO;IAGlB,YAAY,KAAQ;QAClB,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;IACrB,CAAC;IAED,SAAS;QACP,OAAO,IAAI,CAAC;IACd,CAAC;IAED,SAAS;QACP,OAAO,KAAK,CAAC;IACf,CAAC;CACF;AAdD,0BAcC;AAED,MAAM,OAAO;IAGX,YAAY,KAAQ;QAClB,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;IACrB,CAAC;IAED,SAAS;QACP,OAAO,KAAK,CAAC;IACf,CAAC;IAED,SAAS;QACP,OAAO,IAAI,CAAC;IACd,CAAC;CACF;AAEM,MAAM,OAAO,GAAG,CAAO,CAAI,EAAgB,EAAE;IAClD,OAAO,IAAI,OAAO,CAAC,CAAC,CAAC,CAAC;AACxB,CAAC,CAAC;AAFW,QAAA,OAAO,WAElB;AAEK,MAAM,OAAO,GAAG,CAAO,CAAI,EAAgB,EAAE;IAClD,OAAO,IAAI,OAAO,CAAO,CAAC,CAAC,CAAC;AAC9B,CAAC,CAAC;AAFW,QAAA,OAAO,WAElB"}
|
package/lib/index.d.ts
CHANGED
package/lib/index.js
CHANGED
|
@@ -15,4 +15,5 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
__exportStar(require("./environment/environment"), exports);
|
|
18
|
+
__exportStar(require("./environment/either"), exports);
|
|
18
19
|
//# sourceMappingURL=index.js.map
|
package/lib/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,4DAA0C;AAC1C,uDAAqC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@apipass/common",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.18-alpha.0",
|
|
4
4
|
"description": "> TODO: description",
|
|
5
5
|
"author": "Nathan Lemos <nathan@apipass.com.br>",
|
|
6
6
|
"license": "ISC",
|
|
@@ -21,5 +21,5 @@
|
|
|
21
21
|
"scripts": {
|
|
22
22
|
"tsc": "tsc"
|
|
23
23
|
},
|
|
24
|
-
"gitHead": "
|
|
24
|
+
"gitHead": "a851238bd4d94c177138606b644a303dcccf9966"
|
|
25
25
|
}
|