Skip to content

Commit

Permalink
Update json-patch-duplex.ts
Browse files Browse the repository at this point in the history
  • Loading branch information
Joachim Wester committed Mar 19, 2014
1 parent c399cad commit 058df04
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/json-patch-duplex.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,14 @@ interface Object {

module jsonpatch {

/* We use a Javascript hash to store each
function. Each hash entry (property) uses
the operation identifiers specified in rfc6902.
In this way, we can map each patch operation
to its dedicated function in efficient way.
*/

/* The operations applicable to an object */
var objOps = {
add: function (obj, key) {
obj[key] = this.value;
Expand Down Expand Up @@ -50,6 +58,7 @@ module jsonpatch {
}
};

/* The operations applicable to an array. Many are the same as for the object */
var arrOps = {
add: function (arr, i) {
arr.splice(i, 0, this.value);
Expand Down Expand Up @@ -482,4 +491,4 @@ if (typeof exports !== "undefined") {
exports.observe = jsonpatch.observe;
exports.unobserve = jsonpatch.unobserve;
exports.generate = jsonpatch.generate;
}
}

0 comments on commit 058df04

Please sign in to comment.