a simple diff implementation in javascript