orbitdb-archive / ipfs-log

Append-only log CRDT on IPFS
https://orbitdb.github.io/ipfs-log/
MIT License
398 stars 55 forks source link

Incorrect log-sorting.js docstrings #263

Open ghost opened 5 years ago

ghost commented 5 years ago

I'm currently making a Rust port of IPFS log, and I noticed that the docstring return values in log-sorting.js are incorrect:

  1. It is claimed @returns {number} 1 if a is greater, -1 if b is greater when actually it is the other way around.
  2. SortByClocks is claimed to return 1 or -1 (in the manner stated above), but in reality it returns the time difference between the two clocks, which can potentially be any signed integer. (Naturally and fortunately though, this doesn't affect its behavior as a sorting compare function, which it is used as.)