cujojs/jiff — pull request #16 by briancavalier (2014-05-12 21:00:00+00:00)
Title: Add commutation

This is not a complete implementation, so I'm labeling it as experimental in the README. It handles patches that either refer to elements in the same array, or where one refers to a descendent of an element in the same array as the other. IOW, the common ancestor must be an array.

Tree (object) commutation will come later, but we don't really need it for our current use cases.

Trying to commute patches that cannot be commuted will throw a `TypeError`. For example, trying to commute a patch that adds an array element, and a patch that removes that same element: you can't remove an item before you add it.