Skip to content

Commit

Permalink
Eliminate vars from levelTransform.
Browse files Browse the repository at this point in the history
Maybe a slight improvement on the `guard` statement, which accidentally got committed with [096779b][1].

[1]: 096779b#diff-7cdcec63d0737ef47d9d73ef8d064e37L169  "Accidental Section of Commit"
  • Loading branch information
jdhealy committed Sep 15, 2015
1 parent 9f0c411 commit 249fe70
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions Source/Color/Wrap.swift
Original file line number Diff line number Diff line change
Expand Up @@ -144,13 +144,15 @@ public struct Wrap: SelectGraphicRenditionWrapType {
) {
return self.parameters.reduce(
(transformed: false, parameters: [] as UnderlyingCollection)
) { (var previous, value) in
guard let color = value as? ColorType where color.level == level else {
previous.parameters.append(value)
return previous
) { previous, value in
if
let color = value as? ColorType where color.level == level,
case let transformation = [ transform(color) ] as UnderlyingCollection
{
return (transformed: true, parameters: previous.parameters + transformation)
} else {
return (previous.transformed, previous.parameters + [value])
}

return (transformed: true, parameters: previous.parameters + [transform(color)])
}
}

Expand Down

0 comments on commit 249fe70

Please sign in to comment.