Skip to content

otjs/ot

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ot

A line-based operational transform algorithm

Build Status Dependency Status

Install

npm install otjs

Usage

var transform = require('otjs');

var res = transform.transformBatch([
  // Operation "S"
  { type: 'del', line: 0 },
  { type: 'del', line: 0 },
  { type: 'del', line: 0 }
], [
  // Operation "C"
  { type: 'add', line: 0, text: '0' },
  { type: 'add', line: 2, text: '2' },
  { type: 'add', line: 4, text: '4' }
]);

expect(res).to.eql([
  [
    // Operation "S'"
    { type: 'del', line: 1 },
    { type: 'del', line: 2 },
    { type: 'del', line: 3 }
  ], [
    // Operation "C'"
    { type: 'add', line: 0, text: '0' },
    { type: 'add', line: 1, text: '2' },
    { type: 'add', line: 2, text: '4' }
  ]
]);

// S + C' === C + S'

About

A line-based operational transform algorithm

Resources

License

Stars

Watchers

Forks

Packages

No packages published