michael@0: "use strict"; michael@0: michael@0: var method = require("../method/core") michael@0: var rebase = require("./rebase") michael@0: michael@0: // Method is designed to work with data structures representing application michael@0: // state. Calling it with a state and delta should return object representing michael@0: // new state, with changes in `delta` being applied to previous. michael@0: // michael@0: // ## Example michael@0: // michael@0: // patch(state, { michael@0: // "item-id-1": { completed: false }, // update michael@0: // "item-id-2": null // delete michael@0: // }) michael@0: var patch = method("patch@diffpatcher") michael@0: patch.define(Object, function patch(hash, delta) { michael@0: return rebase({}, hash, delta) michael@0: }) michael@0: michael@0: module.exports = patch