CoolFace
Datasetpublic

basant307/AI_Governance_Project

sourceHugging Faceapache-2.0updated 2mo agoView on Hugging Face
0likes45downloads
some.js28 linesDownload Raw Back to obliterator
1/**2 * Obliterator Some Function3 * ==========================4 *5 * Function taking an iterable and a predicate and returning whether a6 * matching item can be found.7 */8var iter = require('./iter.js');9 10/**11 * Some.12 *13 * @param  {Iterable} iterable  - Target iterable.14 * @param  {function} predicate - Predicate function.15 * @return {boolean}16 */17module.exports = function some(iterable, predicate) {18  var iterator = iter(iterable);19 20  var step;21 22  while (((step = iterator.next()), !step.done)) {23    if (predicate(step.value)) return true;24  }25 26  return false;27};28 
basant307/AI_Governance_Project · CoolFace