This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* @author StephenChips | |
* | |
* Notes: | |
* 1. There is no need to have a stack if the function is recursive. | |
* 2. To ensure every object only has one copy, you have to use a Map to map the | |
* objects to their copies. | |
* 3. Unlike toJSON, function deepClone should be able to handle cyclic objects. | |
* 4. Some object cannot be clone (or doesn't have a relaible method) and should just | |
* return themselves directly. |