addon-sdk/source/lib/diffpatcher/patch.js

Wed, 31 Dec 2014 06:55:50 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:55:50 +0100
changeset 2
7e26c7da4463
permissions
-rw-r--r--

Added tag UPSTREAM_283F7C6 for changeset ca08bd8f51b2

     1 "use strict";
     3 var method = require("../method/core")
     4 var rebase = require("./rebase")
     6 // Method is designed to work with data structures representing application
     7 // state. Calling it with a state and delta should return object representing
     8 // new state, with changes in `delta` being applied to previous.
     9 //
    10 // ## Example
    11 //
    12 // patch(state, {
    13 //   "item-id-1": { completed: false }, // update
    14 //   "item-id-2": null                  // delete
    15 // })
    16 var patch = method("patch@diffpatcher")
    17 patch.define(Object, function patch(hash, delta) {
    18   return rebase({}, hash, delta)
    19 })
    21 module.exports = patch

mercurial