Skip to content

Commit

Permalink
Use map instead of mapValues/shuffle in XMLCoderElement.flatten (#93)
Browse files Browse the repository at this point in the history
* Use map instead of mapValues in XMLCoderElement.flatten
* Remove whitespace
  • Loading branch information
jsbean authored and MaxDesiatov committed Apr 30, 2019
1 parent 5cd2ebb commit 38a0f17
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions Sources/XMLCoder/Auxiliaries/XMLCoderElement.swift
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,10 @@ struct XMLCoderElement: Equatable {
}

func flatten() -> KeyedBox {
let attributes = KeyedStorage(self.attributes.mapValues {
StringBox($0) as SimpleBox
}.shuffled())
let attributes = KeyedStorage(self.attributes.map { (key, value) in
(key: key, value: StringBox(value) as SimpleBox)
})
let storage = KeyedStorage<String, Box>()

var elements = self.elements.reduce(storage) { $0.merge(element: $1) }

// Handle attributed unkeyed value <foo attr="bar">zap</foo>
Expand Down

0 comments on commit 38a0f17

Please sign in to comment.