@jscutlery/operators 1.1.1 → 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/CHANGELOG.md CHANGED
@@ -2,6 +2,20 @@
2
2
 
3
3
  This file was generated using [@jscutlery/semver](https://github.com/jscutlery/semver).
4
4
 
5
+ # [2.0.0](https://github.com/jscutlery/devkit/compare/operators-1.1.1...operators-2.0.0) (2023-04-18)
6
+
7
+
8
+ ### Tests
9
+
10
+ * **operators:** make suspensify strict by default ([93b8c05](https://github.com/jscutlery/devkit/commit/93b8c0576086ff476e9239ead6175c8832f39c0e))
11
+
12
+
13
+ ### BREAKING CHANGES
14
+
15
+ * **operators:** suspensify() without options will return a strict suspense object
16
+
17
+
18
+
5
19
  ## [1.1.1](https://github.com/jscutlery/devkit/compare/operators-1.1.0...operators-1.1.1) (2023-04-18)
6
20
 
7
21
 
package/README.md CHANGED
@@ -7,8 +7,8 @@ This package regroups a couple of RxJS operators meant to simplify some common p
7
7
  - [`suspensify`](#suspensify)
8
8
  - [Goals](#goals)
9
9
  - [Usage](#usage)
10
- - [Strict mode (will become default in 3.0.0)](#strict-mode-will-become-default-in-300)
11
- - [Lax mode (default)](#lax-mode-default)
10
+ - [Strict mode (default)](#strict-mode-default)
11
+ - [Lax mode](#lax-mode)
12
12
  - [With Angular](#with-angular)
13
13
  - [With `@rx-angular/state`](#with-rx-angularstate)
14
14
  - [Alternatives](#alternatives)
@@ -48,13 +48,13 @@ The `suspensify` operator is meant to provide a simple and efficient way of deal
48
48
 
49
49
  ## Usage
50
50
 
51
- ### Strict mode (will become default in 3.0.0)
51
+ ### Strict mode (default)
52
52
 
53
53
  Thanks to strict mode the emitted suspense can be narrowed down.
54
54
 
55
55
  ```ts
56
56
  interval(1000)
57
- .pipe(take(2), suspensify({strict: true}))
57
+ .pipe(take(2), suspensify())
58
58
  .subscribe((suspense) => {
59
59
  suspense.value; // 💥
60
60
  suspense.error; // 💥
@@ -93,11 +93,11 @@ interval(1000)
93
93
  }
94
94
  ```
95
95
 
96
- ### Lax mode (default)
96
+ ### Lax mode
97
97
 
98
98
  ```ts
99
99
  interval(1000)
100
- .pipe(take(2), suspensify())
100
+ .pipe(take(2), suspensify({strict: false}))
101
101
  .subscribe((data) => console.log(data));
102
102
  ```
103
103
 
package/index.cjs CHANGED
@@ -1077,7 +1077,7 @@ $({ target: 'Object', stat: true, arity: 2, forced: Object.assign !== assign },
1077
1077
  });
1078
1078
 
1079
1079
  function suspensify({
1080
- strict = false
1080
+ strict = true
1081
1081
  } = {}) {
1082
1082
  return source$ => {
1083
1083
  const strictSuspense$ = source$.pipe(_suspensify(), _coalesceFirstEmittedValue());
package/index.js CHANGED
@@ -1073,7 +1073,7 @@ $({ target: 'Object', stat: true, arity: 2, forced: Object.assign !== assign },
1073
1073
  });
1074
1074
 
1075
1075
  function suspensify({
1076
- strict = false
1076
+ strict = true
1077
1077
  } = {}) {
1078
1078
  return source$ => {
1079
1079
  const strictSuspense$ = source$.pipe(_suspensify(), _coalesceFirstEmittedValue());
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jscutlery/operators",
3
- "version": "1.1.1",
3
+ "version": "2.0.0",
4
4
  "repository": {
5
5
  "url": "https://github.com/jscutlery/devkit"
6
6
  },
@@ -33,11 +33,7 @@ export interface SuspenseEmpty {
33
33
  hasValue: false;
34
34
  pending: false;
35
35
  }
36
- export declare type SuspenseStrict<T> = SuspensePending | SuspenseWithValue<T> | SuspenseWithError | SuspenseEmpty;
37
- /**
38
- * @todo 3.0.0: Make `Suspense` an alias for `SuspenseStrict`.
39
- */
40
- export declare type Suspense<T> = SuspenseLax<T>;
36
+ export declare type Suspense<T> = SuspensePending | SuspenseWithValue<T> | SuspenseWithError | SuspenseEmpty;
41
37
  export interface SuspensifyOptions {
42
38
  strict?: boolean;
43
39
  }
@@ -53,4 +49,4 @@ export declare function suspensify<T>(options?: {
53
49
  }): OperatorFunction<T, SuspenseLax<T>>;
54
50
  export declare function suspensify<T>(options: {
55
51
  strict: true;
56
- }): OperatorFunction<T, SuspenseStrict<T>>;
52
+ }): OperatorFunction<T, Suspense<T>>;