mirror of
https://github.com/ItsElaineTime/SwresTools.git
synced 2024-12-13 12:29:16 +00:00
19 lines
367 B
Swift
19 lines
367 B
Swift
//
|
|
// DictionaryExtras.swift
|
|
// SwresTools
|
|
//
|
|
|
|
extension Dictionary {
|
|
init(_ elements: Array<Element>){
|
|
self.init()
|
|
for (key, value) in elements {
|
|
self[key] = value
|
|
}
|
|
}
|
|
|
|
func flatMap(transform: (Key, Value) -> (Key, Value)?) -> Dictionary<Key, Value> {
|
|
return Dictionary(self.flatMap(transform))
|
|
}
|
|
}
|
|
|