@dereekb/rxjs 13.5.1 → 13.6.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/index.cjs.js CHANGED
@@ -2077,11 +2077,16 @@ var DEFAULT_FACTORY_TIMER_INTERVAL = 1000;
2077
2077
  /**
2078
2078
  * Convenience wrapper for {@link cleanup} that calls `destroy()` on each replaced {@link Destroyable} instance.
2079
2079
  *
2080
+ * Accepts both {@link Destroyable} and {@link Maybe}<{@link Destroyable}> values,
2081
+ * skipping cleanup for nullish emissions.
2082
+ *
2080
2083
  * @param wait - whether to wait for the previous destroy to complete before emitting
2081
2084
  * @returns an operator that manages Destroyable lifecycle
2082
2085
  */ function cleanupDestroyable(wait) {
2083
2086
  return cleanup(function(x) {
2084
- return x.destroy();
2087
+ if (x) {
2088
+ return x.destroy();
2089
+ }
2085
2090
  }, wait);
2086
2091
  }
2087
2092
 
@@ -2688,10 +2693,23 @@ function _unsupported_iterable_to_array$5(o, minLen) {
2688
2693
  */ function distinctUntilHasDifferentValues() {
2689
2694
  return rxjs.distinctUntilChanged(util.hasSameValues);
2690
2695
  }
2691
- function distinctUntilItemsHaveDifferentValues(readValues) {
2696
+ /**
2697
+ * `distinctUntilChanged` variant that extracts iterable values from the emitted item and only emits
2698
+ * when the set of extracted values changes.
2699
+ *
2700
+ * @param readValues - function to extract the iterable of values to compare
2701
+ * @returns operator that suppresses consecutive emissions whose extracted iterable values are the same
2702
+ */ function distinctUntilItemsHaveDifferentValues(readValues) {
2692
2703
  return distinctUntilItemsValueChanges(readValues, util.hasSameValues);
2693
2704
  }
2694
- function distinctUntilItemsValueChanges(readValues, isEqualComparator) {
2705
+ /**
2706
+ * `distinctUntilChanged` variant that extracts values from the emitted item and compares them
2707
+ * using a custom equality comparator.
2708
+ *
2709
+ * @param readValues - function to extract the value to compare
2710
+ * @param isEqualComparator - custom equality function for the extracted values
2711
+ * @returns operator that suppresses consecutive emissions whose extracted values are considered equal
2712
+ */ function distinctUntilItemsValueChanges(readValues, isEqualComparator) {
2695
2713
  return rxjs.distinctUntilChanged(util.compareEqualityWithValueFromItemsFunction(readValues, isEqualComparator));
2696
2714
  }
2697
2715
 
package/index.esm.js CHANGED
@@ -2075,11 +2075,16 @@ var DEFAULT_FACTORY_TIMER_INTERVAL = 1000;
2075
2075
  /**
2076
2076
  * Convenience wrapper for {@link cleanup} that calls `destroy()` on each replaced {@link Destroyable} instance.
2077
2077
  *
2078
+ * Accepts both {@link Destroyable} and {@link Maybe}<{@link Destroyable}> values,
2079
+ * skipping cleanup for nullish emissions.
2080
+ *
2078
2081
  * @param wait - whether to wait for the previous destroy to complete before emitting
2079
2082
  * @returns an operator that manages Destroyable lifecycle
2080
2083
  */ function cleanupDestroyable(wait) {
2081
2084
  return cleanup(function(x) {
2082
- return x.destroy();
2085
+ if (x) {
2086
+ return x.destroy();
2087
+ }
2083
2088
  }, wait);
2084
2089
  }
2085
2090
 
@@ -2686,10 +2691,23 @@ function _unsupported_iterable_to_array$5(o, minLen) {
2686
2691
  */ function distinctUntilHasDifferentValues() {
2687
2692
  return distinctUntilChanged(hasSameValues);
2688
2693
  }
2689
- function distinctUntilItemsHaveDifferentValues(readValues) {
2694
+ /**
2695
+ * `distinctUntilChanged` variant that extracts iterable values from the emitted item and only emits
2696
+ * when the set of extracted values changes.
2697
+ *
2698
+ * @param readValues - function to extract the iterable of values to compare
2699
+ * @returns operator that suppresses consecutive emissions whose extracted iterable values are the same
2700
+ */ function distinctUntilItemsHaveDifferentValues(readValues) {
2690
2701
  return distinctUntilItemsValueChanges(readValues, hasSameValues);
2691
2702
  }
2692
- function distinctUntilItemsValueChanges(readValues, isEqualComparator) {
2703
+ /**
2704
+ * `distinctUntilChanged` variant that extracts values from the emitted item and compares them
2705
+ * using a custom equality comparator.
2706
+ *
2707
+ * @param readValues - function to extract the value to compare
2708
+ * @param isEqualComparator - custom equality function for the extracted values
2709
+ * @returns operator that suppresses consecutive emissions whose extracted values are considered equal
2710
+ */ function distinctUntilItemsValueChanges(readValues, isEqualComparator) {
2693
2711
  return distinctUntilChanged(compareEqualityWithValueFromItemsFunction(readValues, isEqualComparator));
2694
2712
  }
2695
2713
 
package/package.json CHANGED
@@ -1,9 +1,9 @@
1
1
  {
2
2
  "name": "@dereekb/rxjs",
3
- "version": "13.5.1",
3
+ "version": "13.6.0",
4
4
  "peerDependencies": {
5
5
  "rxjs": "^7.8.0",
6
- "@dereekb/util": "13.5.1"
6
+ "@dereekb/util": "13.6.0"
7
7
  },
8
8
  "exports": {
9
9
  "./package.json": "./package.json",
@@ -1,4 +1,4 @@
1
- import { type Destroyable, type PromiseOrValue } from '@dereekb/util';
1
+ import { type Destroyable, type Maybe, type PromiseOrValue } from '@dereekb/util';
2
2
  import { type MonoTypeOperatorFunction } from 'rxjs';
3
3
  /**
4
4
  * RxJS operator that calls a destroy function on the previous value whenever a new value is emitted.
@@ -15,7 +15,10 @@ export declare function cleanup<T>(destroy: (instance: T) => PromiseOrValue<void
15
15
  /**
16
16
  * Convenience wrapper for {@link cleanup} that calls `destroy()` on each replaced {@link Destroyable} instance.
17
17
  *
18
+ * Accepts both {@link Destroyable} and {@link Maybe}<{@link Destroyable}> values,
19
+ * skipping cleanup for nullish emissions.
20
+ *
18
21
  * @param wait - whether to wait for the previous destroy to complete before emitting
19
22
  * @returns an operator that manages Destroyable lifecycle
20
23
  */
21
- export declare function cleanupDestroyable<T extends Destroyable>(wait?: boolean): MonoTypeOperatorFunction<T>;
24
+ export declare function cleanupDestroyable<T extends Maybe<Destroyable>>(wait?: boolean): MonoTypeOperatorFunction<T>;
@@ -34,8 +34,7 @@ export declare function distinctUntilHasDifferentValues<I extends Iterable<K>, K
34
34
  * @param readValues - function to extract the iterable of values to compare
35
35
  * @returns operator that suppresses consecutive emissions whose extracted iterable values are the same
36
36
  */
37
- export declare function distinctUntilItemsHaveDifferentValues<I, V extends Iterable<PrimativeKey>>(readValues: ReadValueFunction<I, V>): MonoTypeOperatorFunction<I>;
38
- export declare function distinctUntilItemsHaveDifferentValues<I, V extends Iterable<PrimativeKey>>(readValues: ReadValueFunction<I, V>): MonoTypeOperatorFunction<Maybe<I>>;
37
+ export declare function distinctUntilItemsHaveDifferentValues<I extends Maybe<unknown>, V extends Iterable<PrimativeKey>>(readValues: ReadValueFunction<NonNullable<I>, V>): MonoTypeOperatorFunction<I>;
39
38
  /**
40
39
  * `distinctUntilChanged` variant that extracts values from the emitted item and compares them
41
40
  * using a custom equality comparator.
@@ -44,5 +43,4 @@ export declare function distinctUntilItemsHaveDifferentValues<I, V extends Itera
44
43
  * @param isEqualComparator - custom equality function for the extracted values
45
44
  * @returns operator that suppresses consecutive emissions whose extracted values are considered equal
46
45
  */
47
- export declare function distinctUntilItemsValueChanges<I, V>(readValues: ReadValueFunction<I, V>, isEqualComparator: EqualityComparatorFunction<V>): MonoTypeOperatorFunction<I>;
48
- export declare function distinctUntilItemsValueChanges<I, V>(readValues: ReadValueFunction<I, V>, isEqualComparator: EqualityComparatorFunction<V>): MonoTypeOperatorFunction<Maybe<I>>;
46
+ export declare function distinctUntilItemsValueChanges<I extends Maybe<unknown>, V>(readValues: ReadValueFunction<NonNullable<I>, V>, isEqualComparator: EqualityComparatorFunction<V>): MonoTypeOperatorFunction<I>;