@lokalise/node-core 2.2.0 → 2.3.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/dist/index.d.ts CHANGED
@@ -8,3 +8,4 @@ export { ConfigScope } from './src/config/ConfigScope';
8
8
  export { ensureClosingSlashTransformer } from './src/config/configTransformers';
9
9
  export { createRangeValidator } from './src/config/configValidators';
10
10
  export type { EnvValueValidator, EnvValueTransformer, AppConfig, RedisConfig, } from './src/config/configTypes';
11
+ export type { Either } from './src/errors/either';
@@ -0,0 +1,17 @@
1
+ type Left<T> = {
2
+ error: T;
3
+ result?: never;
4
+ };
5
+ type Right<U> = {
6
+ error?: never;
7
+ result: U;
8
+ };
9
+ /**
10
+ * Either is a functional programming type which is used to communicate errors happening in potentially recoverable scenarios.
11
+ * It can return either an error (Left side) or a resolved result (Right side), but not both.
12
+ * It is up to caller of the function to handle received error or throw (Public)NonRecoverableError if it cannot.
13
+ *
14
+ * @see {@link https://antman-does-software.com/stop-catching-errors-in-typescript-use-the-either-type-to-make-your-code-predictable Further reading on motivation for Either type}
15
+ */
16
+ export type Either<T, U> = NonNullable<Left<T> | Right<U>>;
17
+ export {};
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=either.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"either.js","sourceRoot":"","sources":["../../../src/errors/either.ts"],"names":[],"mappings":""}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lokalise/node-core",
3
- "version": "2.2.0",
3
+ "version": "2.3.0",
4
4
  "author": {
5
5
  "name": "Lokalise",
6
6
  "url": "https://lokalise.com/"