mirror of
https://github.com/meshtastic/Meshtastic-Apple.git
synced 2026-04-20 22:13:56 +00:00
18 lines
337 B
Swift
18 lines
337 B
Swift
//
|
|
// Array.swift
|
|
// Meshtastic
|
|
//
|
|
// Created by Garth Vander Houwen on 4/27/23.
|
|
//
|
|
|
|
import Foundation
|
|
|
|
|
|
extension Array {
|
|
func mapNonNils<T, E>(_ transform: (E) -> T) -> [T] where Element == Optional<E> {
|
|
return self.compactMap { element in
|
|
guard let element = element else { return nil }
|
|
return transform(element)
|
|
}
|
|
}
|
|
}
|