basant307/AI_Governance_Project
045
1import addSetEntry from './_addSetEntry.js';2import arrayReduce from './_arrayReduce.js';3import setToArray from './_setToArray.js';4 5/** Used to compose bitmasks for cloning. */6var CLONE_DEEP_FLAG = 1;7 8/**9 * Creates a clone of `set`.10 *11 * @private12 * @param {Object} set The set to clone.13 * @param {Function} cloneFunc The function to clone values.14 * @param {boolean} [isDeep] Specify a deep clone.15 * @returns {Object} Returns the cloned set.16 */17function cloneSet(set, isDeep, cloneFunc) {18 var array = isDeep ? cloneFunc(setToArray(set), CLONE_DEEP_FLAG) : setToArray(set);19 return arrayReduce(array, addSetEntry, new set.constructor);20}21 22export default cloneSet;23 