source: frontend/node_modules/@sinonjs/commons/lib/every.js

Last change on this file was 9af201e, checked in by MBK <marija.karapandzova@…>, 13 days ago

Fix frontend appearance

  • Property mode set to 100644
File size: 666 bytes
Line 
1"use strict";
2
3/**
4 * Returns true when fn returns true for all members of obj.
5 * This is an every implementation that works for all iterables
6 *
7 * @param {object} obj
8 * @param {Function} fn
9 * @returns {boolean}
10 */
11module.exports = function every(obj, fn) {
12 var pass = true;
13
14 try {
15 // eslint-disable-next-line @sinonjs/no-prototype-methods/no-prototype-methods
16 obj.forEach(function () {
17 if (!fn.apply(this, arguments)) {
18 // Throwing an error is the only way to break `forEach`
19 throw new Error();
20 }
21 });
22 } catch (e) {
23 pass = false;
24 }
25
26 return pass;
27};
Note: See TracBrowser for help on using the repository browser.