nodeca/js-yaml — pull request #148 by Loamhoof (2014-10-07 12:47:16+00:00)
Title: Circular data & cross references #110

Adding an option (checkDuplicates) to catch circular and cross
references, disabled by default so as not to slow down any existing code (only a few bits of code are still executed when the option is disabled).

Implemented following @puzrin suggestion that is: do a first pass to get the duplicates, and then put the aliases inside the algorithm. Slower than @larkox 's implementation, but perhaps easier to maintain.

Also added a related test.

NB: There may be some unused aliases if a duplicate is found inside a custom type, which must be a pretty rare case.