src/util.js
function _instanceCopy(sourceRef, copyRef, rc, copier) {
    let origIndex = rc.xStack.indexOf(sourceRef);
    if (origIndex === -1) {
        rc.push(sourceRef, copyRef);
        forEach(sourceRef, function(value, key) {
            copier(copyRef, value, key);
        });
        rc.pop();
        return copyRef;
    }
    else
        return rc.yStack[origIndex];
}
function _instanceCopy(sourceRef, copyRef, rc, copier) {
    let origIndex = rc.xStack.indexOf(sourceRef);
    if (origIndex === -1) {
        rc.push(sourceRef, copyRef);
        forEach(sourceRef, function(value, key) {
            copier(copyRef, value, key);
        });
        rc.pop();
        return copyRef;
    }
    else
        return rc.yStack[origIndex];
}
The shared instance copier based on provided callback.

@param sourceRef A reference to the source.
@param copyRef A reference to the copy.
@param rc The current recurse and reference counter.
@param copier The callback used to make a copy of the property list from source to copy reference.
@returns {any} The reference to the copy.