From d3d53bce247a20c39ca1933b5e217e81d71f1219 Mon Sep 17 00:00:00 2001 From: Olivier Halligon Date: Sat, 27 May 2017 19:42:44 +0200 Subject: [PATCH] Fix indentation --- Sources/Environment.swift | 12 ++++++------ Sources/Filters+Strings.swift | 14 +++++++------- Sources/MapNode.swift | 34 +++++++++++++++++----------------- 3 files changed, 30 insertions(+), 30 deletions(-) diff --git a/Sources/Environment.swift b/Sources/Environment.swift index a1ec0520..2e863a89 100644 --- a/Sources/Environment.swift +++ b/Sources/Environment.swift @@ -13,12 +13,12 @@ public extension Extension { registerTag("call", parser: CallNode.parse) registerTag("map", parser: MapNode.parse) - registerFilter("camelToSnakeCase", filter: Filters.Strings.camelToSnakeCase) - registerFilter("escapeReservedKeywords", filter: Filters.Strings.escapeReservedKeywords) - registerFilter("lowerFirstWord", filter: Filters.Strings.lowerFirstWord) - registerFilter("removeNewlines", filter: Filters.Strings.removeNewlines) - registerFilter("snakeToCamelCase", filter: Filters.Strings.snakeToCamelCase) - registerFilter("swiftIdentifier", filter: Filters.Strings.stringToSwiftIdentifier) + registerFilter("camelToSnakeCase", filter: Filters.Strings.camelToSnakeCase) + registerFilter("escapeReservedKeywords", filter: Filters.Strings.escapeReservedKeywords) + registerFilter("lowerFirstWord", filter: Filters.Strings.lowerFirstWord) + registerFilter("removeNewlines", filter: Filters.Strings.removeNewlines) + registerFilter("snakeToCamelCase", filter: Filters.Strings.snakeToCamelCase) + registerFilter("swiftIdentifier", filter: Filters.Strings.stringToSwiftIdentifier) registerFilter("titlecase", filter: Filters.Strings.titlecase) registerFilter("hexToInt", filter: Filters.Numbers.hexToInt) diff --git a/Sources/Filters+Strings.swift b/Sources/Filters+Strings.swift index 12fd7ee2..6db426be 100644 --- a/Sources/Filters+Strings.swift +++ b/Sources/Filters+Strings.swift @@ -119,15 +119,15 @@ extension Filters { return escapeReservedKeywords(in: string) } - static func removeNewlines(_ value: Any?, arguments: [Any?]) throws -> Any? { - let removeSpaces = try Filters.parseBool(from: arguments, index: 0, required: false) ?? true - guard let string = value as? String else { throw Filters.Error.invalidInputType } + static func removeNewlines(_ value: Any?, arguments: [Any?]) throws -> Any? { + let removeSpaces = try Filters.parseBool(from: arguments, index: 0, required: false) ?? true + guard let string = value as? String else { throw Filters.Error.invalidInputType } - let set: CharacterSet = removeSpaces ? .whitespacesAndNewlines : .newlines - let result = string.components(separatedBy: set).joined() + let set: CharacterSet = removeSpaces ? .whitespacesAndNewlines : .newlines + let result = string.components(separatedBy: set).joined() - return result - } + return result + } // MARK: - Private methods diff --git a/Sources/MapNode.swift b/Sources/MapNode.swift index 88c96587..41bcba0c 100644 --- a/Sources/MapNode.swift +++ b/Sources/MapNode.swift @@ -55,7 +55,7 @@ class MapNode: NodeType { if let values = values as? [Any], values.count > 0 { let mappedValues: [String] = try values.enumerated().map { (index, item) in - let mapContext = self.context(values: values, index: index, item: item) + let mapContext = self.context(values: values, index: index, item: item) return try context.push(dictionary: mapContext) { try renderNodes(nodes, context) @@ -68,20 +68,20 @@ class MapNode: NodeType { return "" } - func context(values: [Any], index: Int, item: Any) -> [String: Any] { - var result: [String: Any] = [ - "maploop": [ - "counter": index, - "first": index == 0, - "last": index == (values.count - 1), - "item": item - ] - ] - - if let mapVariable = mapVariable { - result[mapVariable] = item - } - - return result - } + func context(values: [Any], index: Int, item: Any) -> [String: Any] { + var result: [String: Any] = [ + "maploop": [ + "counter": index, + "first": index == 0, + "last": index == (values.count - 1), + "item": item + ] + ] + + if let mapVariable = mapVariable { + result[mapVariable] = item + } + + return result + } }