CoolFace
Datasetpublic

basant307/AI_Governance_Project

sourceHugging Faceapache-2.0updated 2mo agoView on Hugging Face
0likes48downloads
reduce.mjs18 linesDownload Raw Back to map
1function reduce(map, callback, initialValue) {2    if (initialValue == null && map.size === 0) {3        throw new TypeError('Reduce of empty map with no initial value');4    }5    let accumulator = initialValue;6    for (const [key, value] of map) {7        if (accumulator == null) {8            accumulator = value;9        }10        else {11            accumulator = callback(accumulator, value, key, map);12        }13    }14    return accumulator;15}16 17export { reduce };18 
basant307/AI_Governance_Project · CoolFace