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.
It's intended to be a set. Imagine the following:
> var duplicate = {};
> var source = [duplicate, duplicate, duplicate];

With the current code, the index appears only once. If I replaced it with an array, it would be pushed twice and we'd have `[1, 1]` instead of `{1: true}`.