0.6.2 • Published 7 years ago

diff_three_way v0.6.2

Weekly downloads
24
License
MIT
Repository
github
Last release
7 years ago

diff_three_way

Travis npm package

Installation

npm install diff_three_way --save

Usage

ES6

import Content from 'diff_three_way'
let content = new Content()

ES5

var Content = require('diff_three_way').default
var content = new Content()

API

  • content.setContent(str) - set 'content' of current content instance.
  • content.createPatch(array || object) - create a patch based on the input array. Input object should look like:
    [{
      "start": 257, // the index of first charater
      "orgChars": ">", // the origin characters
      "newChars": ">Wonderful "  // the updated characters
    }]
    or
    {
      "text1": ">",
      "text2": ">Wonderful ",
      "id": 123
    }
  • content.loadPatches(array) - load patches(array of patch object) to current content instance.
  • content.getPatches() - get patches(array of patch object) in current content instance.
  • content.applyPatch(object, boolean) - apply patch object on content to update 'content' in current content instance, if there multiple patches loaded in current content instance, then those patches will be updated by three way merge, conflict ones will be ignored when getPatches() is called. Returns 'content' applied patch object when boolean is true('content' in current content instance will not be updated). No returns when boolean is false.
0.6.2

7 years ago

0.6.1

7 years ago

0.5.3

7 years ago

0.5.2

7 years ago

0.5.1

7 years ago

0.5.0

7 years ago

0.4.1

7 years ago

0.4.0

7 years ago

0.3.1

7 years ago

0.3.0

7 years ago

0.2.0

7 years ago

0.1.1-SNAPSHOT

7 years ago

0.0.1-SNAPSHOT

7 years ago