File size: 426 Bytes
96af7c9
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
export const cloneMethod = Symbol.for('fast-check/cloneMethod');
export function hasCloneMethod(instance) {
    return (instance !== null &&
        (typeof instance === 'object' || typeof instance === 'function') &&
        cloneMethod in instance &&
        typeof instance[cloneMethod] === 'function');
}
export function cloneIfNeeded(instance) {
    return hasCloneMethod(instance) ? instance[cloneMethod]() : instance;
}