scats 1.4.0-dev → 1.4.1-dev

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 (83) hide show
  1. package/dist/abstract-map.d.ts +4 -4
  2. package/dist/abstract-map.js +12 -15
  3. package/dist/abstract-set.d.ts +2 -2
  4. package/dist/abstract-set.js +6 -9
  5. package/dist/array-iterable.d.ts +1 -1
  6. package/dist/array-iterable.js +22 -26
  7. package/dist/collection.d.ts +4 -4
  8. package/dist/collection.js +50 -71
  9. package/dist/either.d.ts +4 -4
  10. package/dist/either.js +31 -39
  11. package/dist/hashmap.d.ts +2 -2
  12. package/dist/hashmap.js +9 -12
  13. package/dist/hashset.d.ts +3 -3
  14. package/dist/hashset.js +6 -11
  15. package/dist/index.d.ts +8 -8
  16. package/dist/index.js +9 -13
  17. package/dist/mappable.js +1 -2
  18. package/dist/mutable/hashmap.d.ts +3 -3
  19. package/dist/mutable/hashmap.js +3 -8
  20. package/dist/mutable/hashset.d.ts +2 -2
  21. package/dist/mutable/hashset.js +3 -8
  22. package/dist/mutable.d.ts +3 -3
  23. package/dist/mutable.js +3 -9
  24. package/dist/option.d.ts +6 -6
  25. package/dist/option.js +34 -44
  26. package/dist/try.d.ts +3 -3
  27. package/dist/try.js +27 -37
  28. package/dist/util.d.ts +2 -2
  29. package/dist/util.js +41 -50
  30. package/package.json +1 -1
  31. package/.eslintrc.cjs +0 -44
  32. package/coverage/clover.xml +0 -937
  33. package/coverage/coverage-final.json +0 -15
  34. package/coverage/lcov-report/array-iterable.ts.html +0 -1709
  35. package/coverage/lcov-report/base.css +0 -224
  36. package/coverage/lcov-report/block-navigation.js +0 -79
  37. package/coverage/lcov-report/collection.ts.html +0 -1475
  38. package/coverage/lcov-report/either.ts.html +0 -1934
  39. package/coverage/lcov-report/favicon.png +0 -0
  40. package/coverage/lcov-report/hashmap.ts.html +0 -527
  41. package/coverage/lcov-report/hashset.ts.html +0 -392
  42. package/coverage/lcov-report/index.html +0 -126
  43. package/coverage/lcov-report/index.ts.html +0 -101
  44. package/coverage/lcov-report/option.ts.html +0 -758
  45. package/coverage/lcov-report/prettify.css +0 -1
  46. package/coverage/lcov-report/prettify.js +0 -2
  47. package/coverage/lcov-report/sort-arrow-sprite.png +0 -0
  48. package/coverage/lcov-report/sorter.js +0 -170
  49. package/coverage/lcov-report/src/abstract-map.ts.html +0 -317
  50. package/coverage/lcov-report/src/abstract-set.ts.html +0 -200
  51. package/coverage/lcov-report/src/array-iterable.ts.html +0 -1751
  52. package/coverage/lcov-report/src/collection.ts.html +0 -1778
  53. package/coverage/lcov-report/src/either.ts.html +0 -1934
  54. package/coverage/lcov-report/src/hashmap.ts.html +0 -428
  55. package/coverage/lcov-report/src/hashset.ts.html +0 -482
  56. package/coverage/lcov-report/src/index.html +0 -276
  57. package/coverage/lcov-report/src/index.ts.html +0 -110
  58. package/coverage/lcov-report/src/mutable/hashmap.ts.html +0 -821
  59. package/coverage/lcov-report/src/mutable/hashset.ts.html +0 -611
  60. package/coverage/lcov-report/src/mutable/index.html +0 -126
  61. package/coverage/lcov-report/src/mutable.ts.html +0 -89
  62. package/coverage/lcov-report/src/option.ts.html +0 -758
  63. package/coverage/lcov-report/src/try.ts.html +0 -923
  64. package/coverage/lcov-report/src/util.ts.html +0 -518
  65. package/coverage/lcov-report/try.ts.html +0 -923
  66. package/coverage/lcov-report/util.ts.html +0 -518
  67. package/coverage/lcov.info +0 -2223
  68. package/jest.config.js +0 -32
  69. package/src/abstract-map.ts +0 -79
  70. package/src/abstract-set.ts +0 -40
  71. package/src/array-iterable.ts +0 -557
  72. package/src/collection.ts +0 -619
  73. package/src/either.ts +0 -618
  74. package/src/hashmap.ts +0 -116
  75. package/src/hashset.ts +0 -134
  76. package/src/index.ts +0 -10
  77. package/src/mappable.ts +0 -8
  78. package/src/mutable/hashmap.ts +0 -247
  79. package/src/mutable/hashset.ts +0 -177
  80. package/src/mutable.ts +0 -3
  81. package/src/option.ts +0 -226
  82. package/src/try.ts +0 -281
  83. package/src/util.ts +0 -146
package/dist/hashmap.js CHANGED
@@ -1,22 +1,21 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.HashMap = void 0;
4
- const index_1 = require("./index");
5
- const abstract_map_1 = require("./abstract-map");
6
- class HashMap extends abstract_map_1.AbstractMap {
1
+ import { mutable } from './index.js';
2
+ import { AbstractMap } from './abstract-map.js';
3
+ export class HashMap extends AbstractMap {
4
+ map;
5
+ fromArray(array) {
6
+ return HashMap.of(...array);
7
+ }
7
8
  constructor(map) {
8
9
  super(map);
9
10
  this.map = map;
10
11
  }
11
- fromArray(array) {
12
- return HashMap.of(...array);
13
- }
14
12
  static of(...values) {
15
13
  return new HashMap(new Map(values));
16
14
  }
17
15
  static from(values) {
18
16
  return HashMap.of(...Array.from(values));
19
17
  }
18
+ static empty = new HashMap(new Map());
20
19
  appendedAll(map) {
21
20
  return this.concat(map);
22
21
  }
@@ -66,8 +65,6 @@ class HashMap extends abstract_map_1.AbstractMap {
66
65
  };
67
66
  }
68
67
  get toMutable() {
69
- return index_1.mutable.HashMap.of(...Array.from(this.map.entries()));
68
+ return mutable.HashMap.of(...Array.from(this.map.entries()));
70
69
  }
71
70
  }
72
- exports.HashMap = HashMap;
73
- HashMap.empty = new HashMap(new Map());
package/dist/hashset.d.ts CHANGED
@@ -1,6 +1,6 @@
1
- import { HashMap } from './hashmap';
2
- import { AbstractSet } from './abstract-set';
3
- import * as mutable from './mutable/hashset';
1
+ import { HashMap } from './hashmap.js';
2
+ import { AbstractSet } from './abstract-set.js';
3
+ import * as mutable from './mutable/hashset.js';
4
4
  export declare class HashSet<T> extends AbstractSet<T, HashSet<T>> {
5
5
  protected constructor(items: Set<T>);
6
6
  static empty: HashSet<any>;
package/dist/hashset.js CHANGED
@@ -1,14 +1,11 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.HashSet = void 0;
4
- const tslib_1 = require("tslib");
5
- const hashmap_1 = require("./hashmap");
6
- const abstract_set_1 = require("./abstract-set");
7
- const mutable = (0, tslib_1.__importStar)(require("./mutable/hashset"));
8
- class HashSet extends abstract_set_1.AbstractSet {
1
+ import { HashMap } from './hashmap.js';
2
+ import { AbstractSet } from './abstract-set.js';
3
+ import * as mutable from './mutable/hashset.js';
4
+ export class HashSet extends AbstractSet {
9
5
  constructor(items) {
10
6
  super(items);
11
7
  }
8
+ static empty = new HashSet(new Set());
12
9
  static of(...items) {
13
10
  return new HashSet(new Set(items));
14
11
  }
@@ -19,7 +16,7 @@ class HashSet extends abstract_set_1.AbstractSet {
19
16
  return HashSet.of(...array);
20
17
  }
21
18
  toMap(mapper) {
22
- return hashmap_1.HashMap.of(...this.map(mapper).toArray);
19
+ return HashMap.of(...this.map(mapper).toArray);
23
20
  }
24
21
  map(f) {
25
22
  return HashSet.of(...Array.from(this.items).map(i => f(i)));
@@ -62,5 +59,3 @@ class HashSet extends abstract_set_1.AbstractSet {
62
59
  return mutable.HashSet.of(...this.items);
63
60
  }
64
61
  }
65
- exports.HashSet = HashSet;
66
- HashSet.empty = new HashSet(new Set());
package/dist/index.d.ts CHANGED
@@ -1,9 +1,9 @@
1
- export * from './collection';
2
- export * from './either';
3
- export * from './hashmap';
4
- export * from './hashset';
5
- export * from './option';
6
- export * from './try';
7
- export * from './util';
8
- import * as mutable from './mutable';
1
+ export * from './collection.js';
2
+ export * from './either.js';
3
+ export * from './hashmap.js';
4
+ export * from './hashset.js';
5
+ export * from './option.js';
6
+ export * from './try.js';
7
+ export * from './util.js';
8
+ import * as mutable from './mutable.js';
9
9
  export { mutable };
package/dist/index.js CHANGED
@@ -1,13 +1,9 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.mutable = void 0;
4
- const tslib_1 = require("tslib");
5
- (0, tslib_1.__exportStar)(require("./collection"), exports);
6
- (0, tslib_1.__exportStar)(require("./either"), exports);
7
- (0, tslib_1.__exportStar)(require("./hashmap"), exports);
8
- (0, tslib_1.__exportStar)(require("./hashset"), exports);
9
- (0, tslib_1.__exportStar)(require("./option"), exports);
10
- (0, tslib_1.__exportStar)(require("./try"), exports);
11
- (0, tslib_1.__exportStar)(require("./util"), exports);
12
- const mutable = (0, tslib_1.__importStar)(require("./mutable"));
13
- exports.mutable = mutable;
1
+ export * from './collection.js';
2
+ export * from './either.js';
3
+ export * from './hashmap.js';
4
+ export * from './hashset.js';
5
+ export * from './option.js';
6
+ export * from './try.js';
7
+ export * from './util.js';
8
+ import * as mutable from './mutable.js';
9
+ export { mutable };
package/dist/mappable.js CHANGED
@@ -1,2 +1 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
1
+ export {};
@@ -1,6 +1,6 @@
1
- import { Option } from '../option';
2
- import { AbstractMap, Tuple2 } from '../abstract-map';
3
- import * as immutable from '../hashmap';
1
+ import { Option } from '../option.js';
2
+ import { AbstractMap, Tuple2 } from '../abstract-map.js';
3
+ import * as immutable from '../hashmap.js';
4
4
  export declare class HashMap<K, V> extends AbstractMap<K, V, HashMap<K, V>> {
5
5
  constructor(map?: Map<K, V>);
6
6
  protected fromArray(array: Tuple2<K, V>[]): HashMap<K, V>;
@@ -1,10 +1,6 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.HashMap = void 0;
4
- const tslib_1 = require("tslib");
5
- const abstract_map_1 = require("../abstract-map");
6
- const immutable = (0, tslib_1.__importStar)(require("../hashmap"));
7
- class HashMap extends abstract_map_1.AbstractMap {
1
+ import { AbstractMap } from '../abstract-map.js';
2
+ import * as immutable from '../hashmap.js';
3
+ export class HashMap extends AbstractMap {
8
4
  constructor(map = new Map()) {
9
5
  super(map);
10
6
  }
@@ -115,4 +111,3 @@ class HashMap extends abstract_map_1.AbstractMap {
115
111
  return immutable.HashMap.of(...this.map.entries());
116
112
  }
117
113
  }
118
- exports.HashMap = HashMap;
@@ -1,5 +1,5 @@
1
- import { AbstractSet } from '../abstract-set';
2
- import * as immutable from '../hashset';
1
+ import { AbstractSet } from '../abstract-set.js';
2
+ import * as immutable from '../hashset.js';
3
3
  export declare class HashSet<T> extends AbstractSet<T, HashSet<T>> {
4
4
  constructor(items?: Set<T>);
5
5
  static of<T>(...items: T[]): HashSet<T>;
@@ -1,10 +1,6 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.HashSet = void 0;
4
- const tslib_1 = require("tslib");
5
- const abstract_set_1 = require("../abstract-set");
6
- const immutable = (0, tslib_1.__importStar)(require("../hashset"));
7
- class HashSet extends abstract_set_1.AbstractSet {
1
+ import { AbstractSet } from '../abstract-set.js';
2
+ import * as immutable from '../hashset.js';
3
+ export class HashSet extends AbstractSet {
8
4
  constructor(items = new Set()) {
9
5
  super(items);
10
6
  }
@@ -85,4 +81,3 @@ class HashSet extends abstract_set_1.AbstractSet {
85
81
  return immutable.HashSet.of(...this.items);
86
82
  }
87
83
  }
88
- exports.HashSet = HashSet;
package/dist/mutable.d.ts CHANGED
@@ -1,3 +1,3 @@
1
- export { ArrayBuffer } from './collection';
2
- export { HashMap } from './mutable/hashmap';
3
- export { HashSet } from './mutable/hashset';
1
+ export { ArrayBuffer } from './collection.js';
2
+ export { HashMap } from './mutable/hashmap.js';
3
+ export { HashSet } from './mutable/hashset.js';
package/dist/mutable.js CHANGED
@@ -1,9 +1,3 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.HashSet = exports.HashMap = exports.ArrayBuffer = void 0;
4
- var collection_1 = require("./collection");
5
- Object.defineProperty(exports, "ArrayBuffer", { enumerable: true, get: function () { return collection_1.ArrayBuffer; } });
6
- var hashmap_1 = require("./mutable/hashmap");
7
- Object.defineProperty(exports, "HashMap", { enumerable: true, get: function () { return hashmap_1.HashMap; } });
8
- var hashset_1 = require("./mutable/hashset");
9
- Object.defineProperty(exports, "HashSet", { enumerable: true, get: function () { return hashset_1.HashSet; } });
1
+ export { ArrayBuffer } from './collection.js';
2
+ export { HashMap } from './mutable/hashmap.js';
3
+ export { HashSet } from './mutable/hashset.js';
package/dist/option.d.ts CHANGED
@@ -1,9 +1,9 @@
1
- import { Collection } from './collection';
2
- import { Either } from './either';
3
- import { ArrayIterable } from './array-iterable';
4
- import { HashSet } from './hashset';
5
- import { HashMap } from './hashmap';
6
- import { Mappable } from './mappable';
1
+ import { Collection } from './collection.js';
2
+ import { Either } from './either.js';
3
+ import { ArrayIterable } from './array-iterable.js';
4
+ import { HashSet } from './hashset.js';
5
+ import { HashMap } from './hashmap.js';
6
+ import { Mappable } from './mappable.js';
7
7
  export interface OptionMatch<A, T> {
8
8
  some: (value: A) => T;
9
9
  none: () => T;
package/dist/option.js CHANGED
@@ -1,20 +1,16 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.none = exports.some = exports.option = exports.None = exports.Some = exports.Option = void 0;
4
- const tslib_1 = require("tslib");
5
- const collection_1 = require("./collection");
6
- const either_1 = require("./either");
7
- const array_iterable_1 = require("./array-iterable");
8
- const hashset_1 = require("./hashset");
9
- const hashmap_1 = require("./hashmap");
10
- class Option extends array_iterable_1.ArrayIterable {
1
+ import { Collection } from './collection.js';
2
+ import { Left, left, Right, right } from './either.js';
3
+ import { ArrayIterable } from './array-iterable.js';
4
+ import { HashSet } from './hashset.js';
5
+ import { HashMap } from './hashmap.js';
6
+ export class Option extends ArrayIterable {
11
7
  static when(cond) {
12
8
  return a => {
13
9
  if (cond) {
14
10
  return some(a());
15
11
  }
16
12
  else {
17
- return exports.none;
13
+ return none;
18
14
  }
19
15
  };
20
16
  }
@@ -23,7 +19,7 @@ class Option extends array_iterable_1.ArrayIterable {
23
19
  }
24
20
  fromArray(array) {
25
21
  if (array.length <= 0) {
26
- return exports.none;
22
+ return none;
27
23
  }
28
24
  else {
29
25
  return some(array[0]);
@@ -39,39 +35,37 @@ class Option extends array_iterable_1.ArrayIterable {
39
35
  }
40
36
  filter(p) {
41
37
  if (this.isEmpty) {
42
- return exports.none;
38
+ return none;
43
39
  }
44
40
  else {
45
- return p(this.get) ? this : exports.none;
41
+ return p(this.get) ? this : none;
46
42
  }
47
43
  }
48
44
  filterNot(p) {
49
45
  if (this.isEmpty) {
50
- return exports.none;
46
+ return none;
51
47
  }
52
48
  else {
53
- return p(this.get) ? exports.none : this;
49
+ return p(this.get) ? none : this;
54
50
  }
55
51
  }
56
52
  map(f) {
57
- return this.isEmpty ? exports.none : some(f(this.get));
53
+ return this.isEmpty ? none : some(f(this.get));
58
54
  }
59
55
  flatMap(p) {
60
- return this.isEmpty ? exports.none : p(this.get);
56
+ return this.isEmpty ? none : p(this.get);
61
57
  }
62
- mapPromise(f) {
63
- return (0, tslib_1.__awaiter)(this, void 0, void 0, function* () {
64
- if (this.isEmpty) {
65
- return Promise.resolve(exports.none);
66
- }
67
- else {
68
- return option(yield f(this.get));
69
- }
70
- });
58
+ async mapPromise(f) {
59
+ if (this.isEmpty) {
60
+ return Promise.resolve(none);
61
+ }
62
+ else {
63
+ return option(await f(this.get));
64
+ }
71
65
  }
72
66
  flatMapPromise(f) {
73
67
  if (this.isEmpty) {
74
- return Promise.resolve(exports.none);
68
+ return Promise.resolve(none);
75
69
  }
76
70
  else {
77
71
  return f(this.get);
@@ -126,29 +120,29 @@ class Option extends array_iterable_1.ArrayIterable {
126
120
  return this.isEmpty ? undefined : this.get;
127
121
  }
128
122
  get toCollection() {
129
- return this.isEmpty ? collection_1.Collection.empty : collection_1.Collection.of(this.get);
123
+ return this.isEmpty ? Collection.empty : Collection.of(this.get);
130
124
  }
131
125
  toRight(left) {
132
- return this.isEmpty ? new either_1.Left(left()) : (0, either_1.right)(this.get);
126
+ return this.isEmpty ? new Left(left()) : right(this.get);
133
127
  }
134
128
  toLeft(right) {
135
- return this.isEmpty ? new either_1.Right(right()) : (0, either_1.left)(this.get);
129
+ return this.isEmpty ? new Right(right()) : left(this.get);
136
130
  }
137
131
  get toArray() {
138
132
  return this.isEmpty ? [] : [this.get];
139
133
  }
140
134
  get toSet() {
141
- return this.isEmpty ? hashset_1.HashSet.empty : hashset_1.HashSet.of(this.get);
135
+ return this.isEmpty ? HashSet.empty : HashSet.of(this.get);
142
136
  }
143
137
  match(matcher) {
144
138
  return this.isEmpty ? matcher.none() : matcher.some(this.get);
145
139
  }
146
140
  toMap(mapper) {
147
- return this.isEmpty ? hashmap_1.HashMap.empty : hashmap_1.HashMap.of(...this.map(mapper).toArray);
141
+ return this.isEmpty ? HashMap.empty : HashMap.of(...this.map(mapper).toArray);
148
142
  }
149
143
  }
150
- exports.Option = Option;
151
- class Some extends Option {
144
+ export class Some extends Option {
145
+ value;
152
146
  constructor(value) {
153
147
  super();
154
148
  this.value = value;
@@ -160,8 +154,7 @@ class Some extends Option {
160
154
  return false;
161
155
  }
162
156
  }
163
- exports.Some = Some;
164
- class None extends Option {
157
+ export class None extends Option {
165
158
  get get() {
166
159
  throw new Error('No such element.');
167
160
  }
@@ -169,13 +162,10 @@ class None extends Option {
169
162
  return true;
170
163
  }
171
164
  }
172
- exports.None = None;
173
- function option(value) {
174
- return value === null || typeof value === 'undefined' ? exports.none : some(value);
165
+ export function option(value) {
166
+ return value === null || typeof value === 'undefined' ? none : some(value);
175
167
  }
176
- exports.option = option;
177
- function some(value) {
168
+ export function some(value) {
178
169
  return new Some(value);
179
170
  }
180
- exports.some = some;
181
- exports.none = new None();
171
+ export const none = new None();
package/dist/try.d.ts CHANGED
@@ -1,6 +1,6 @@
1
- import { Option } from './option';
2
- import { Either } from './either';
3
- import { Mappable } from './mappable';
1
+ import { Option } from './option.js';
2
+ import { Either } from './either.js';
3
+ import { Mappable } from './mappable.js';
4
4
  export interface TryMatch<T, R> {
5
5
  success: (result: T) => R;
6
6
  failure: (error: Error) => R;
package/dist/try.js CHANGED
@@ -1,17 +1,11 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.failure = exports.success = exports.Try = exports.Failure = exports.Success = exports.TryLike = void 0;
4
- const tslib_1 = require("tslib");
5
- const option_1 = require("./option");
6
- const either_1 = require("./either");
7
- const util_1 = require("./util");
8
- class TryLike {
9
- mapPromise(f) {
10
- return (0, tslib_1.__awaiter)(this, void 0, void 0, function* () {
11
- return this.match({
12
- success: r => Try.promise(() => f(r)),
13
- failure: () => Promise.resolve(this)
14
- });
1
+ import { none, some } from './option.js';
2
+ import { left, right } from './either.js';
3
+ import { identity } from './util.js';
4
+ export class TryLike {
5
+ async mapPromise(f) {
6
+ return this.match({
7
+ success: r => Try.promise(() => f(r)),
8
+ failure: () => Promise.resolve(this)
15
9
  });
16
10
  }
17
11
  flatMapPromise(f) {
@@ -41,24 +35,24 @@ class TryLike {
41
35
  }
42
36
  toEitherWithLeft(f) {
43
37
  return this.match({
44
- success: r => (0, either_1.right)(r),
45
- failure: e => (0, either_1.left)(f(e))
38
+ success: r => right(r),
39
+ failure: e => left(f(e))
46
40
  });
47
41
  }
48
42
  }
49
- exports.TryLike = TryLike;
50
- class Success extends TryLike {
43
+ export class Success extends TryLike {
44
+ result;
45
+ isSuccess = true;
46
+ isFailure = false;
51
47
  constructor(result) {
52
48
  super();
53
49
  this.result = result;
54
- this.isSuccess = true;
55
- this.isFailure = false;
56
50
  }
57
51
  get toOption() {
58
- return (0, option_1.some)(this.result);
52
+ return some(this.result);
59
53
  }
60
54
  get toEither() {
61
- return (0, either_1.right)(this.result);
55
+ return right(this.result);
62
56
  }
63
57
  map(f) {
64
58
  return success(f(this.result));
@@ -120,19 +114,19 @@ class Success extends TryLike {
120
114
  return this.flatMap(s);
121
115
  }
122
116
  }
123
- exports.Success = Success;
124
- class Failure extends TryLike {
117
+ export class Failure extends TryLike {
118
+ error;
119
+ isSuccess = false;
120
+ isFailure = true;
125
121
  constructor(error) {
126
122
  super();
127
123
  this.error = error;
128
- this.isSuccess = false;
129
- this.isFailure = true;
130
124
  }
131
125
  get toOption() {
132
- return option_1.none;
126
+ return none;
133
127
  }
134
128
  get toEither() {
135
- return (0, either_1.left)(this.error);
129
+ return left(this.error);
136
130
  }
137
131
  map(_) {
138
132
  return this;
@@ -178,7 +172,7 @@ class Failure extends TryLike {
178
172
  }
179
173
  }
180
174
  recoverWith(f) {
181
- return this.transform(util_1.identity, f);
175
+ return this.transform(identity, f);
182
176
  }
183
177
  transform(s, f) {
184
178
  try {
@@ -189,8 +183,7 @@ class Failure extends TryLike {
189
183
  }
190
184
  }
191
185
  }
192
- exports.Failure = Failure;
193
- function Try(block) {
186
+ export function Try(block) {
194
187
  try {
195
188
  return new Success(block());
196
189
  }
@@ -198,7 +191,6 @@ function Try(block) {
198
191
  return new Failure(e);
199
192
  }
200
193
  }
201
- exports.Try = Try;
202
194
  (function (Try) {
203
195
  function promise(block) {
204
196
  try {
@@ -211,12 +203,10 @@ exports.Try = Try;
211
203
  }
212
204
  }
213
205
  Try.promise = promise;
214
- })(Try = exports.Try || (exports.Try = {}));
215
- function success(x) {
206
+ })(Try || (Try = {}));
207
+ export function success(x) {
216
208
  return new Success(x);
217
209
  }
218
- exports.success = success;
219
- function failure(x) {
210
+ export function failure(x) {
220
211
  return new Failure(x);
221
212
  }
222
- exports.failure = failure;
package/dist/util.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { Option } from './option';
2
- import { Mappable } from './mappable';
1
+ import { Option } from './option.js';
2
+ import { Mappable } from './mappable.js';
3
3
  export declare function identity<T>(x: T): T;
4
4
  export declare function toErrorConversion(x: unknown): Error;
5
5
  export declare type StepFunction<R> = (state: any) => R;