File size: 494 Bytes
30c32c8
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
/**
 * Methods for cloning JavaScript objects.
 * @type {object}
 */
class Clone {
    /**
     * Deep-clone a "simple" object: one which can be fully expressed with JSON.
     * Non-JSON values, such as functions, will be stripped from the clone.
     * @param {object} original - the object to be cloned.
     * @returns {object} a deep clone of the original object.
     */
    static simple (original) {
        return JSON.parse(JSON.stringify(original));
    }
}

module.exports = Clone;