Skip to content

Commit

Permalink
[F] Implement add.
Browse files Browse the repository at this point in the history
  • Loading branch information
Dominic Frei committed Feb 1, 2016
1 parent 9a61025 commit 87ebc54
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions JsonPatchSwift/JPSJsonPatch.swift
Original file line number Diff line number Diff line change
Expand Up @@ -72,9 +72,10 @@ struct JPSJsonPatch {
extension JPSJsonPatch {

static func applyPatch(jsonPatch: JPSJsonPatch, toJson json: JSON) -> JSON {
// let pointer = jsonPatch.operations[0].pointer
// json[pointer.pointerValue]// = jsonPatch.operation[0].value
return JSON(data: "{ \"bar\" : \"foo\" }".dataUsingEncoding(NSUTF8StringEncoding)!)
let pointer = jsonPatch.operations[0].pointer
var patchedJson = json
patchedJson[pointer.pointerValue] = jsonPatch.operations[0].value
return patchedJson
}

}
Expand Down

0 comments on commit 87ebc54

Please sign in to comment.