Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rename (internal) stringToSwiftIdentifier #46

Merged
merged 2 commits into from
May 27, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@ Due to the removal of legacy code, there are a few breaking changes in this new
* Refactored the `snakeToCamelCase` filter to now accept an (optional) boolean parameter to control the `noPrefix` behaviour.
[David Jennes](https://github.com/djbe)
[#41](https://github.com/SwiftGen/StencilSwiftKit/pull/41)
* Rename the `stringToSwiftIdentifier` function to `swiftIdentifier` to better match the other method names.
[David Jennes](https://github.com/djbe)
[#46](https://github.com/SwiftGen/StencilSwiftKit/pull/46)

### New Features

Expand Down
4 changes: 4 additions & 0 deletions Documentation/MigrationGuide.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,7 @@ We've removed the following deprecated `typealias`es:
* `ParametersError`: use `Parameters.Error` instead.
* `NumFilters`: use `Filters.Numbers` instead.
* `StringFilters`: use `Filters.Strings` instead.

The following functions have been renamed:

* `stringToSwiftIdentifier` renamed to `swiftIdentifier`.
26 changes: 13 additions & 13 deletions Pods/Pods.xcodeproj/project.pbxproj

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Sources/Environment.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ public extension Extension {
registerTag("macro", parser: MacroNode.parse)
registerTag("call", parser: CallNode.parse)
registerTag("map", parser: MapNode.parse)
registerFilter("swiftIdentifier", filter: Filters.Strings.stringToSwiftIdentifier)
registerFilter("swiftIdentifier", filter: Filters.Strings.swiftIdentifier)
registerFilter("lowerFirstWord", filter: Filters.Strings.lowerFirstWord)
registerFilter("snakeToCamelCase", filter: Filters.Strings.snakeToCamelCase)
registerFilter("camelToSnakeCase", filter: Filters.Strings.camelToSnakeCase)
Expand Down
4 changes: 2 additions & 2 deletions Sources/Filters+Strings.swift
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@ extension Filters {
"right", "set", "Type", "unowned", "weak", "willSet"
]

static func stringToSwiftIdentifier(value: Any?) throws -> Any? {
static func swiftIdentifier(_ value: Any?) throws -> Any? {
guard let value = value as? String else { throw Filters.Error.invalidInputType }
return swiftIdentifier(from: value, replaceWithUnderscores: true)
return StencilSwiftKit.swiftIdentifier(from: value, replaceWithUnderscores: true)
}

/* - If the string starts with only one uppercase letter, lowercase that first letter
Expand Down