Skip to content

Commit

Permalink
Merge pull request #94 from vapor/revert-90-beta
Browse files Browse the repository at this point in the history
Revert "Beta"
  • Loading branch information
tanner0101 authored Aug 9, 2017
2 parents e8fd30a + 60e21e9 commit 642f357
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 24 deletions.
17 changes: 3 additions & 14 deletions Sources/Node/Core/NodeRepresentable.swift
Original file line number Diff line number Diff line change
Expand Up @@ -15,21 +15,10 @@ extension NodeRepresentable {
- returns: convertible representation of object
*/
public func converted<T: NodeInitializable>(
to type: T.Type,
to type: T.Type = T.self,
in context: Context?
) throws -> T {
return try converted(in: context) as T
}

/// Map the node back to a convertible type
///
/// - parameter type: the type to map to -- can be inferred
/// - throws: if mapping fails
/// - returns: convertible representation of object
public func converted<T: NodeInitializable>(
in context: Context?
) throws -> T {
) throws -> T {
let node = try makeNode(in: context)
return try T.init(node: node)
return try type.init(node: node)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -24,19 +24,11 @@ extension StructuredDataWrapper {
self.init(wrapped, in: Self.defaultContext)
}

public func converted<T: StructuredDataWrapper>(to type: T.Type) -> T {
public func converted<T: StructuredDataWrapper>(to type: T.Type = T.self) -> T {
return T(wrapped, in: context)
}

public func converted<T: StructuredDataWrapper>() -> T {
return T(wrapped, in: context)
}

public func converted<T: NodeInitializable>(to type: T.Type) throws -> T {
return try T.init(node: self)
}

public func converted<T: NodeInitializable>() throws -> T {
public func converted<T: NodeInitializable>(to type: T.Type = T.self) throws -> T {
return try T.init(node: self)
}

Expand Down

0 comments on commit 642f357

Please sign in to comment.