mirror of
https://github.com/ItsElaineTime/SwresTools.git
synced 2025-01-06 01:31:28 +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))
|
||
|
}
|
||
|
}
|
||
|
|