@quenty/rx 13.10.0 → 13.11.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 +11 -0
- package/package.json +2 -2
- package/src/Shared/Rx.lua +41 -1
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,17 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
# [13.11.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/rx@13.10.0...@quenty/rx@13.11.0) (2024-11-03)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Features
|
|
10
|
+
|
|
11
|
+
* Added Rx.switchScan and Rx.mergeScan ([#516](https://github.com/Quenty/NevermoreEngine/issues/516)) ([5d0f762](https://github.com/Quenty/NevermoreEngine/commit/5d0f7626b3206b66c9bcd8bc79197db13f2e1374))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
6
17
|
# [13.10.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/rx@13.9.0...@quenty/rx@13.10.0) (2024-10-23)
|
|
7
18
|
|
|
8
19
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@quenty/rx",
|
|
3
|
-
"version": "13.
|
|
3
|
+
"version": "13.11.0",
|
|
4
4
|
"description": "Quenty's reactive library for Roblox",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"Roblox",
|
|
@@ -41,5 +41,5 @@
|
|
|
41
41
|
"publishConfig": {
|
|
42
42
|
"access": "public"
|
|
43
43
|
},
|
|
44
|
-
"gitHead": "
|
|
44
|
+
"gitHead": "a7e6d8dffd16e9b516e352050571009f57fe6c67"
|
|
45
45
|
}
|
package/src/Shared/Rx.lua
CHANGED
|
@@ -2032,7 +2032,7 @@ function Rx.takeWhile(predicate)
|
|
|
2032
2032
|
|
|
2033
2033
|
return source:Subscribe(function(...)
|
|
2034
2034
|
index += 1
|
|
2035
|
-
|
|
2035
|
+
|
|
2036
2036
|
if predicate(index, ...) then
|
|
2037
2037
|
sub:Fire(...)
|
|
2038
2038
|
else
|
|
@@ -2043,4 +2043,44 @@ function Rx.takeWhile(predicate)
|
|
|
2043
2043
|
end
|
|
2044
2044
|
end
|
|
2045
2045
|
|
|
2046
|
+
--[=[
|
|
2047
|
+
Applies an accumulator function over the source Observable where the accumulator function itself returns an Observable,
|
|
2048
|
+
emitting values only from the most recently returned Observable.
|
|
2049
|
+
|
|
2050
|
+
https://rxjs.dev/api/index/function/switchScan
|
|
2051
|
+
|
|
2052
|
+
@param accumulator function
|
|
2053
|
+
@param seed any | nil
|
|
2054
|
+
@return (source: Observable) -> Observable
|
|
2055
|
+
]=]
|
|
2056
|
+
function Rx.switchScan(accumulator, seed)
|
|
2057
|
+
assert(type(accumulator) == "function", "Bad accumulator")
|
|
2058
|
+
|
|
2059
|
+
return Rx.pipe({
|
|
2060
|
+
Rx.scan(accumulator, seed),
|
|
2061
|
+
Rx.switchAll()
|
|
2062
|
+
})
|
|
2063
|
+
end
|
|
2064
|
+
|
|
2065
|
+
--[=[
|
|
2066
|
+
Applies an accumulator function over the source Observable where the accumulator function itself returns an Observable,
|
|
2067
|
+
then each intermediate Observable returned is merged into the output Observable.
|
|
2068
|
+
|
|
2069
|
+
https://rxjs.dev/api/operators/mergeScan
|
|
2070
|
+
|
|
2071
|
+
@param accumulator function
|
|
2072
|
+
@param seed any | nil
|
|
2073
|
+
@return (source: Observable) -> Observable
|
|
2074
|
+
]=]
|
|
2075
|
+
function Rx.mergeScan(accumulator, seed)
|
|
2076
|
+
assert(type(accumulator) == "function", "Bad accumulator")
|
|
2077
|
+
|
|
2078
|
+
return Rx.pipe({
|
|
2079
|
+
Rx.scan(accumulator, seed),
|
|
2080
|
+
Rx.flatMap(function(x)
|
|
2081
|
+
return x
|
|
2082
|
+
end)
|
|
2083
|
+
})
|
|
2084
|
+
end
|
|
2085
|
+
|
|
2046
2086
|
return Rx
|