import RxSwift
// swiftlint:disable large_tuple
// MARK: - 3 Parameters
public func denestify<A, B, C>(tuple: ((A, B), C)) -> (A, B, C) {
let ((a, b), c) = tuple
return (a, b, c)
}
public func denestify<A, B, C>(tuple: (A, (B, C))) -> (A, B, C) {
let (a, (b, c)) = tuple
return (a, b, c)
}
// MARK: - 4 Parameters
public func denestify<A, B, C, D>(tuple: (A, (B, C, D))) -> (A, B, C, D) {
let (A, (B, C, D)) = tuple
return (A, B, C, D)
}
public func denestify<A, B, C, D>(tuple: ((A, B), (C, D))) -> (A, B, C, D) {
let ((A, B), (C, D)) = tuple
return (A, B, C, D)
}
public func denestify<A, B, C, D>(tuple: ((A, B, C), D)) -> (A, B, C, D) {
let ((A, B, C), D) = tuple
return (A, B, C, D)
}
public func denestify<A, B, C, D>(tuple: (A, B, (C, D))) -> (A, B, C, D) {
let (A, B, (C, D)) = tuple
return (A, B, C, D)
}
public func denestify<A, B, C, D>(tuple: (A, (B, C), D)) -> (A, B, C, D) {
let (A, (B, C), D) = tuple
return (A, B, C, D)
}
public func denestify<A, B, C, D>(tuple: ((A, B), C, D)) -> (A, B, C, D) {
let ((A, B), C, D) = tuple
return (A, B, C, D)
}
public func denestify<A, B, C, D>(tuple: (((A, B), C), D)) -> (A, B, C, D) {
let (((A, B), C), D) = tuple
return (A, B, C, D)
}
// MARK: - 5 Parameters
public func denestify<A, B, C, D, E>(tuple: (A, (B, C, D, E))) -> (A, B, C, D, E) {
let (A, (B, C, D, E)) = tuple
return (A, B, C, D, E)
}
public func denestify<A, B, C, D, E>(tuple: ((A, B), (C, D, E))) -> (A, B, C, D, E) {
let ((A, B), (C, D, E)) = tuple
return (A, B, C, D, E)
}
public func denestify<A, B, C, D, E>(tuple: ((A, B, C), (D, E))) -> (A, B, C, D, E) {
let ((A, B, C), (D, E)) = tuple
return (A, B, C, D, E)
}
public func denestify<A, B, C, D, E>(tuple: ((A, B, C, D), E)) -> (A, B, C, D, E) {
let ((A, B, C, D), E) = tuple
return (A, B, C, D, E)
}
public func denestify<A, B, C, D, E>(tuple: (A, B, (C, D, E))) -> (A, B, C, D, E) {
let (A, B, (C, D, E)) = tuple
return (A, B, C, D, E)
}
public func denestify<A, B, C, D, E>(tuple: (A, (B, C), (D, E))) -> (A, B, C, D, E) {
let (A, (B, C), (D, E)) = tuple
return (A, B, C, D, E)
}
public func denestify<A, B, C, D, E>(tuple: (A, (B, C, D), E)) -> (A, B, C, D, E) {
let (A, (B, C, D), E) = tuple
return (A, B, C, D, E)
}
public func denestify<A, B, C, D, E>(tuple: ((A, B), C, (D, E))) -> (A, B, C, D, E) {
let ((A, B), C, (D, E)) = tuple
return (A, B, C, D, E)
}
public func denestify<A, B, C, D, E>(tuple: ((A, B), (C, D), E)) -> (A, B, C, D, E) {
let ((A, B), (C, D), E) = tuple
return (A, B, C, D, E)
}
public func denestify<A, B, C, D, E>(tuple: ((A, B, C), D, E)) -> (A, B, C, D, E) {
let ((A, B, C), D, E) = tuple
return (A, B, C, D, E)
}
public func denestify<A, B, C, D, E>(tuple: (A, B, C, (D, E))) -> (A, B, C, D, E) {
let (A, B, C, (D, E)) = tuple
return (A, B, C, D, E)
}
public func denestify<A, B, C, D, E>(tuple: (A, B, (C, D), E)) -> (A, B, C, D, E) {
let (A, B, (C, D), E) = tuple
return (A, B, C, D, E)
}
public func denestify<A, B, C, D, E>(tuple: (A, (B, C), D, E)) -> (A, B, C, D, E) {
let (A, (B, C), D, E) = tuple
return (A, B, C, D, E)
}
public func denestify<A, B, C, D, E>(tuple: ((A, B), C, D, E)) -> (A, B, C, D, E) {
let ((A, B), C, D, E) = tuple
return (A, B, C, D, E)
}
// MARK: - Observable + Denestify
extension ObservableType {
/// Убирает вложенность из картэжей
public func denestifyTuple<A, B, C>() -> Observable<(A, B, C)> where Element == ((A, B), C) {
map { denestify(tuple: $0) }
}
/// Убирает вложенность из картэжей
public func denestifyTuple<A, B, C>() -> Observable<(A, B, C)> where Element == (A, (B, C)) {
map { denestify(tuple: $0) }
}
/// Убирает вложенность из картэжей
public func denestifyTuple<A, B, C, D>() -> Observable<(A, B, C, D)> where Element == ((A, B), (C, D)) {
map { denestify(tuple: $0) }
}
/// Убирает вложенность из картэжей
public func denestifyTuple<A, B, C, D>() -> Observable<(A, B, C, D)> where Element == (A, (B, C), D) {
map { denestify(tuple: $0) }
}
/// Убирает вложенность из картэжей
public func denestifyTuple<A, B, C, D>() -> Observable<(A, B, C, D)> where Element == ((A, B, C), D) {
map { denestify(tuple: $0) }
}
/// Убирает вложенность из картэжей
public func denestifyTuple<A, B, C, D>() -> Observable<(A, B, C, D)> where Element == (A, (B, C, D)) {
map { denestify(tuple: $0) }
}
/// Убирает вложенность из картэжей
public func denestifyTuple<A, B, C, D>() -> Observable<(A, B, C, D)> where Element == (((A, B), C), D) {
map { denestify(tuple: $0) }
}
}
// swiftlint:enable large_tuple
Created
May 19, 2020 09:43
-
-
Save iDmitriyy/cfe46190eae605ebc1dc445c36a44648 to your computer and use it in GitHub Desktop.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment