|
@@ -489,6 +489,15 @@ function Observable:pack()
|
|
|
return self:map(pack)
|
|
|
end
|
|
|
|
|
|
+--- Returns two Observables: one that produces values for which the predicate returns truthy for,
|
|
|
+-- and another that produces values for which the predicate returns falsy.
|
|
|
+-- @arg {function} predicate - The predicate used to partition the values.
|
|
|
+-- @returns {Observable}
|
|
|
+-- @returns {Observable}
|
|
|
+function Observable:partition(predicate)
|
|
|
+ return self:filter(predicate), self:reject(predicate)
|
|
|
+end
|
|
|
+
|
|
|
--- Returns a new Observable that produces values computed by extracting the given key from the
|
|
|
-- tables produced by the original.
|
|
|
-- @arg {function} key - The key to extract from the table.
|