Example #1
0
    return async function(dispatch, getState) {
        let { dashboards, dashcards, dashboardId } = getState().dashboard;
        let dashboard = {
            ...dashboards[dashboardId],
            ordered_cards: dashboards[dashboardId].ordered_cards.map(dashcardId => dashcards[dashcardId])
        };

        // remove isRemoved dashboards
        await Promise.all(dashboard.ordered_cards
            .filter(dc => dc.isRemoved && !dc.isAdded)
            .map(dc => DashboardApi.removecard({ dashId: dashboard.id, dashcardId: dc.id })));

        // add isAdded dashboards
        let updatedDashcards = await Promise.all(dashboard.ordered_cards
            .filter(dc => !dc.isRemoved)
            .map(async dc => {
                if (dc.isAdded) {
                    let result = await DashboardApi.addcard({ dashId, cardId: dc.card_id });
                    dispatch(updateDashcardId(dc.id, result.id));
                    // mark isAdded because addcard doesn't record the position
                    return {
                        ...result,
                        col: dc.col, row: dc.row,
                        sizeX: dc.sizeX, sizeY: dc.sizeY,
                        series: dc.series,
                        parameter_mappings: dc.parameter_mappings,
                        visualization_settings: dc.visualization_settings,
                        isAdded: true
                    }
                } else {
                    return dc;
                }
            }));

        // update modified cards
        await Promise.all(dashboard.ordered_cards
            .filter(dc => dc.card.isDirty)
            .map(async dc => CardApi.update(dc.card)));

        // update the dashboard itself
        if (dashboard.isDirty) {
            let { id, name, description, parameters } = dashboard;
            dashboard = await DashboardApi.update({ id, name, description, parameters });
        }

        // reposition the cards
        if (_.some(updatedDashcards, (dc) => dc.isDirty || dc.isAdded)) {
            let cards = updatedDashcards.map(({ id, card_id, row, col, sizeX, sizeY, series, parameter_mappings, visualization_settings }) =>
                ({
                    id, card_id, row, col, sizeX, sizeY, series, visualization_settings,
                    parameter_mappings: parameter_mappings && parameter_mappings.filter(mapping =>
                        // filter out mappings for deleted paramters
                        _.findWhere(dashboard.parameters, { id: mapping.parameter_id }) &&
                        // filter out mappings for deleted series
                        (card_id === mapping.card_id || _.findWhere(series, { id: mapping.card_id }))
                    )
                })
            );
            var result = await DashboardApi.reposition_cards({ dashId, cards });
            if (result.status !== "ok") {
                throw new Error(result.status);
            }
        }

        // make sure that we've fully cleared out any dirty state from editing (this is overkill, but simple)
        dispatch(fetchDashboard(dashId, null, true)); // disable using query parameters when saving

        MetabaseAnalytics.trackEvent("Dashboard", "Update");

        return dashboard;
    };
Example #2
0
 var endsWith = function () {
   return _.some(arguments, function (suffix) {
     return inputTrimmed.indexOf(suffix, inputTrimmed.length - suffix.length) !== -1;
   });
 };
Example #3
0
function isKnownTestEndpoint(authorityUrl) {
  return _.some(knownTestEndpoints, function (endpoint) {
    return utils.ignoreCaseEquals(endpoint, authorityUrl);
  });
}
Example #4
0
 componentWillMount() {
   this.updateInitialData();
 },
 isLocked() {
   return !!this.props.cluster.task({group: 'deployment', active: true}) ||
     !_.every(this.props.nodes.invokeMap('areDisksConfigurable'));
 },
 updateInitialData() {
   this.setState({initialDisks: _.cloneDeep(this.props.nodes.at(0).disks.toJSON())});
 },
 hasChanges() {
   var disks = this.props.disks.toJSON();
   var {initialDisks} = this.state;
   return !this.isLocked() && _.some(
     models.Disk.prototype.editableAttributes,
     (diskProperty) => {
       return !_.isEqual(_.map(disks, diskProperty), _.map(initialDisks, diskProperty));
     }
   );
 },
 loadDefaults() {
   this.setState({actionInProgress: true});
   this.props.disks.fetch({url: _.result(this.props.nodes.at(0), 'url') + '/disks/defaults/'})
     .then(
       () => {
         this.setState({actionInProgress: false});
       },
       (response) => {
         var ns = 'cluster_page.nodes_tab.configure_disks.configuration_error.';
         this.setState({actionInProgress: false});
         utils.showErrorDialog({
           title: i18n(ns + 'title'),
Example #5
0
function hasAnySuppressableKey(props) {
  return _.some(['alarms', 'checks', 'entities', 'notification_plans'],
    hasKey(props));
}
Example #6
0
(_.map(['hello', 'world'], function(e) { return e.length }): Array<number>);
(_.map({hello: 1, world: 2}, function(v, k) { return k.length }): Array<number>);
// $ExpectError This type is incompatible with string
(_.map({hello: 1, world: 2}, function(v, k) { return k * 2 }): Array<number>);

(_.mapObject({foo: 1, bar: 2}, function (v, k) {return (k.length + v).toString()}): {[key: string]: string});
// $ExpectError This type is incompatible with number
(_.mapObject({foo: 1, bar: 2}, function (v, k) {return (k.length + v).toString()}): number);

(_.pluck([{name: 'bob'}, {name: 'jane'}], 'name'): Array<string>);
(_.reduce([1, 2, 3], function(m, o) { return m + o }, 0): number);
(_.all([2, 4, 5], function(i) { return i % 2 == 0 }): boolean);
// $ExpectError Property not found in Number
(_.all([2, 4, 5], function(i) { return i.length }): boolean);
(_.some([2, 4, 5], function(i) { return i % 2 == 0 }): boolean);
(_.union(['a', 'b'], ['b']): Array<string>);
(_.intersection(['a', 'b'], ['b']): Array<string>);
(_.difference(['a', 'b'], ['b']): Array<string>);
(_.first([1,2,3]): number);
(_.first([1,2,3], 2): Array<number>);
(_.last([1,2,3]): number);
(_.last([1,2,3], 2): Array<number>);
(_.sample([1,2,3]): number);
(_.sortBy(['hello', 'world'], function(e) { return e.length }): Array<string>);
(_.uniq([1,2,2]): Array<number>);
(_.compact([1, null]): Array<number>);
(_.select([1,2,3], function(e) { return e % 2 == 0 }): Array<number>);
(_.reject([1,2,3], function(e) { return e % 2 == 0 }): Array<number>);
(_.without([1,2,3], 1, 2): Array<number>);
(_.has({a: 1, b: 2}, 'b'): boolean);
 hasChanges: function() {
     return _.some(this.activeEditorComponents, function(component) {
         return component.isChanged();
     });
 },
Example #8
0
Auth0Widget.prototype._initialize = function (widgetLoadedCallback) {
  var self = this;
  this._$().addClass('a0-mode-signin');

  // wait for setClient()
  if (!self._client) {
    var args  = arguments;
    var setClient = global.window.Auth0.setClient;

    global.window.Auth0.setClient = function () {
      setClient.apply(this, arguments);
      self._initialize.apply(self, args);
    };

    return;
  }

  // buttons actions
  this._$('.a0-onestep a.a0-close').a0_on('click', function () { self._hideSignIn(); });
  this._$('.a0-notloggedin form').a0_on('submit', function (e) { self._signInEnterprise(e); });
  this._$('').a0_on('keyup', function (e) {
    if ((e.which == 27 || e.keycode == 27) && !self._signinOptions.standalone) {
      self._hideSignIn(); // close popup with ESC key
    }
  });

  if (self._client.subscription && !~['free', 'dev'].indexOf(self._client.subscription)) {
    // hide footer for non free/dev subscriptions
    this._$('.a0-footer').toggleClass('a0-hide', true);
    this._$('.a0-free-subscription').removeClass('a0-free-subscription');
  }

  // images from cdn
  // this._$('.a0-header a.a0-close').css('background-image', 'url(' + self._signinOptions.cdn + 'img/close.png)');

  // labels text
  var options = _.extend({}, this._signinOptions, this._signinOptions.resources);
  options['showEmail'] = typeof options['showEmail'] !== 'undefined' ? options['showEmail'] : true;
  options['showPassword'] = typeof options['showPassword'] !== 'undefined' ? options['showPassword'] : true;
  options['enableReturnUserExperience'] = typeof options['enableReturnUserExperience'] !== 'undefined' ? options['enableReturnUserExperience'] : true;
  options['enableADRealmDiscovery'] = typeof options['enableADRealmDiscovery'] !== 'undefined' ? options['enableADRealmDiscovery'] : true;

  this._signinOptions = options;

  // activate panel
  this._$('div.a0-panel').removeClass('a0-active');
  this._$('div.a0-overlay').addClass('a0-active');
  this._$('div.a0-panel.a0-onestep').addClass('a0-active');

  if (self._signinOptions.container) {
    this._$('div.a0-active').removeClass('a0-overlay');
  }

  this._$('.a0-popup h1').html(this._dict.t('signin:title'));
  this._$('.a0-popup .a0-invalid').removeClass('a0-invalid');

  this._$('div.a0-panel.a0-onestep h1').html(this._signinOptions['title']);

  if (self._signinOptions.connections) {
    self._client.strategies = _.chain(self._client.strategies)
                                .map(function (s) {
                                  s.connections = _.filter(s.connections, function (c) {
                                    return _.contains(self._signinOptions.connections, c.name);
                                  });
                                  return s;
                                }).filter(function (s) {
                                  return s.connections.length > 0;
                                }).value();
  }


  // merge strategies info
  for (var s = 0; s < self._client.strategies.length; s++) {
    var strategy_name = self._client.strategies[s].name;
    self._client.strategies[s] = _.extend({}, self._client.strategies[s], self._strategies[strategy_name]);
  }

  self._auth0Strategies = _.chain(self._client.strategies)
                            .filter(function (s) { return s.userAndPass && s.connections.length > 0; })
                            .value();

  var auth0Conn = this._getAuth0Connection() || {};
  if (self._openWith === 'SignUp' && !auth0Conn.showSignup && !self._signinOptions.signupLink) self._openWith = null;
  if (self._openWith === 'Reset' && !auth0Conn.showForgot && !self._signinOptions.forgotLink) self._openWith = null;

  // show loading
  self._showLoadingExperience();

  function finish(err, ssoData){
    self._ssoData = ssoData;
    if (self._openWith) {
      return self['_show' + self._openWith + 'Experience']();
    }
    self._resolveLoginView();
    if (widgetLoadedCallback && typeof widgetLoadedCallback === 'function') widgetLoadedCallback();
  }

  var is_any_ad = _.some(self._client.strategies, function (s) {
    return (s.name === 'ad' || s.name === 'auth0-adldap') &&
            s.connections.length > 0;
  });

  // get SSO data
  if (this._signinOptions.enableReturnUserExperience === false && (!is_any_ad || self._openWith || this._signinOptions.enableADRealmDiscovery === false)) {
    finish(null, {});
  } else {
    self._auth0.getSSOData(is_any_ad, finish);
  }
};
Example #9
0
 scope.showSizeColumnPicker = () => some(scope.options.seriesOptions, options => options.type === 'bubble');
Example #10
0
    function loadPluginFile(pluginPath) {

        var bits = pluginPath.split(path.sep);

        if (pluginPath.match(/\.js$/i)) {

            var plugin;
            var pluginDeclaration = {};

            // Load plugin.
            try {
                plugin = require(pluginPath);
            } catch(ex) {
                console.error("Error loading plugin", pluginPath, ex);
                return;
            }

            if (plugin.notPlugin) {
                // Skip utils modules.
                return;
            }

            // Check if have required method.
            var hasSign = _.some(PLUGINS_FIELDS, function(sign) {
                return sign in plugin;
            });
            if (!hasSign) {
                console.warn("No plugin methods in " + pluginPath + ". Add exports.notPlugin = true; to skip this warning.");
                return;
            }

            // Check methods type.
            var error = false;
            PLUGINS_FIELDS.forEach(function(sign) {
                if (sign in plugin && sign in PLUGIN_FIELDS_TYPE_DICT) {
                    if (!(plugin[sign] instanceof PLUGIN_FIELDS_TYPE_DICT[sign])) {
                        console.error('Type error: "' + sign + '" must be instanceof "' + PLUGIN_FIELDS_TYPE_DICT[sign] + '" in', pluginPath);
                        error = true;
                    }
                }
            });
            if (error) {
                return;
            }

            // Check post plugin.
            // TODO: only prapereLink method abailable.
            // TODO: exclude prapereLink method from other plugins.
            pluginDeclaration.post = bits.indexOf('validators') > -1;
            if (pluginDeclaration.post) {
                if (!('prepareLink' in plugin)) {
                    console.error('Type error: "prepareLink" method absent in post plugin', pluginPath);
                    return;
                }
            }

            // ID.
            pluginDeclaration.id = getFileName(bits[bits.length - 1]).toLowerCase();
            if (pluginDeclaration.id in plugins) {
                console.error("Duplicate plugin id (filename)", pluginPath);
                return;
            }

            // Normalize RE.
            if (plugin.re) {
                if (plugin.re instanceof RegExp) {
                    pluginDeclaration.re = [plugin.re];
                } else if (plugin.re instanceof Array) {

                    if (!_.every(plugin.re, function(re) { return re instanceof RegExp; })) {
                        console.error('Invalid RegExp in re of', pluginPath);
                        return;
                    }

                    pluginDeclaration.re = plugin.re;
                } else {
                    console.error('Invalid RegExp or Array in re of', pluginPath);
                    return;
                }
            } else {
                pluginDeclaration.re = [];
            }

            // Fill "plugin provides" dict.
            if (plugin.provides) {

                // Allow non arrays.
                var provides = plugin.provides instanceof Array ? plugin.provides : [plugin.provides];

                provides.forEach(function(param) {

                    if (param === 'self') {
                        // Convert 'self' to plugin id.
                        param = pluginDeclaration.id;
                    }

                    var list = providedParamsDict[param] = providedParamsDict[param] || [];
                    list.push(pluginDeclaration.id);
                });
            }

            // Find domain.
            var domainBitIdx = bits.indexOf('domains');
            if (domainBitIdx > -1) {
                // Domain plugin.
                var domain = bits[domainBitIdx + 1].replace(/^www\./i, "");
                // Remove .js extension if not folder.
                pluginDeclaration.domain = getFileName(domain);
                // Store in pluginsByDomain dict to fast search by domain.
                pluginsByDomain[pluginDeclaration.domain] = pluginDeclaration;
            } else {
                if (plugin.re) {
                    console.warn("re in generic plugin (will never be called)", pluginPath)
                }
            }

            // Find plugin methods params.
            pluginDeclaration.methods = getPluginMethods(pluginPath, plugin);
            for(var method in pluginDeclaration.methods) {
                if (!(method in plugin)) {
                    delete pluginDeclaration.methods[method];
                } else {
                    // Store dict with all plugins params.
                    var params = pluginDeclaration.methods[method];
                    params.forEach(function(param) {
                        var list = usedParamsDict[param] = usedParamsDict[param] || [];
                        list.push(pluginDeclaration.id);
                    });
                }
            }

            pluginDeclaration.module = plugin;

            // Plugins in folder 'custom' or 'core' will be run only on explicit dependency.
            pluginDeclaration.custom = (bits.indexOf('custom') > -1 || bits.indexOf('system') > -1) && !plugin.generic;

            var stat = fs.statSync(pluginPath);
            pluginDeclaration.modified = new Date(stat.mtime);
            pluginDeclaration.getPluginLastModifiedDate = getPluginLastModifiedDate;

            // If no mixins - mark domain plugin 'asks to mixin all generic plugins'.
            if (plugin.mixins) {
                var idx = plugin.mixins.indexOf('*');
                if (idx > -1) {
                    // Remove '*' from array.
                    plugin.mixins.splice(idx, 1);
                    pluginDeclaration.mixinAllGeneric = true;
                }
            }

            // Store plugin.
            plugins[pluginDeclaration.id] = pluginDeclaration;

        } else if (pluginPath.match(/\.ejs$/i)) {

            var id = getFileName(bits[bits.length - 1]).toLowerCase();

            if (id in templates) {
                console.error("Duplicate template id (filename)", pluginPath);
                return;
            }

            templates[id] = pluginPath;
        }
    }
Example #11
0
 _.each(this.card.slots, function(row) {
   foundFullRow |= !_.some(row, _.identity);
 });
Example #12
0
        u.each(config, function (item, index) {
            if (!item.auth || permission.isAllow(item.auth)) {
                var target = item.target ? ' target="' + item.target + '"' : '';
                if (!target && item.externalUrl) {
                    target = ' target="_blank"';
                }
                var internalUrl = fixErUrl(item.url || '');
                var url = item.externalUrl || internalUrl;
                var element = document.createElement('li');
                var separate = '';

                // 处理父tab和子tab权限耦合的部分
                if (item.tabs) {
                    // 看看默认要跳转的地址所在的子tab有没有权限,没有的话得找备胎
                    var hasDefaultTabAuth = u.every(item.tabs, function (subItem) {
                        if (isActive(item.url.replace(/^#/, ''), subItem)) {
                            if (!subItem.auth || permission.isAllow(subItem.auth)) {
                                return true;
                            }
                            else {
                                return false;
                            }
                        }
                    });

                    // 如果没有权限就得找到第一个有权限的子tab,把父tab跳转链接改成这个
                    if (!hasDefaultTabAuth) {
                        // 做最坏的打算,所有不外跳的子tab都没权限,那这个父tab只能直接往外跳了
                        var externalUrlBackUp = '';
                        var isInternalUrlFound = u.some(item.tabs, function (subItem) {
                            if (!subItem.auth || permission.isAllow(subItem.auth)) {
                                if (subItem.url) {
                                    url = fixErUrl(subItem.url);
                                    return true;
                                }
                                else if (subItem.externalUrl && !externalUrlBackUp) {
                                    externalUrlBackUp = subItem.externalUrl;
                                }
                            }
                        });

                        if (!isInternalUrlFound) {
                            // 如果找不到内跳和外跳的备胎
                            // 就说明所有子tab都没权限,那就用原来父tab配的url就可以了
                            url = externalUrlBackUp || url;
                        }
                    }
                }

                element.className = 'nav-' + isSub + 'item';
                element.innerHTML = '<a href="' + url + '"' + target + '>'
                                        + '<span>' + item.text + '</span>'
                                    + '</a>';

                nav.appendChild(element);
                if (isSub && index < u.size(config) - 1) {
                    separate = document.createElement('li');
                    separate.className = 'nav-sub-item nav-sub-separate';
                    separate.innerHTML = '|';
                    nav.appendChild(separate);
                }

                navItems[index] = element;
            }
        });
Example #13
0
    if (choices.length < 2)
      return false;

    var choicesToValidate = index === undefined ? choices : [choices[index]],
        isInvalid = choicesToValidate.reduce((isInvalid, choice) => {
          var value = choice.value.trim();

          isInvalid[choice.id] = !value ||
            choices.filter(a => a.value.trim() === value).length > 1;

          return isInvalid;
        }, {});

    this.setState({
      isInvalid: update(this.state.isInvalid, { $merge: isInvalid })
    });

    return !_.some(isInvalid);
  },

  value() {
    return this.state.value.map(({ value }) => value.trim());
  }
});

function toValue(value) {
  return { id: _.uniqueId(), value, isValid: true };
}

module.exports = ChoicesInput;
Example #14
0
  /**
   * Returns true if we should show mobile app placeholders
   *
   * @param {Client[]} clients - array of attached clients
   * @returns {Boolean}
   * @private
   */
  _showMobileApps (clients) {
    if (this.broker.hasCapability('convertExternalLinksToText')) {
      // if we cannot show links exit out early
      return false;
    }

    // we would show mobile apps if there are no mobile or tablet clients
    return ! _.some(clients, function (client) {
      return client.type === 'mobile' || client.type === 'tablet';
    });
  },

  _onItemRemoved (item) {
    var id = item.get('id');
    $('#' + id).slideUp(DEVICE_REMOVED_ANIMATION_MS, () => {
      // re-render in case the last device is removed and the
      // "no registered devices" message needs to be shown.
      this.render();
    });
  },

  _onDisconnectClient (event) {
    var client = this._attachedClients.get($(event.currentTarget).data('id'));
    var clientType = client.get('clientType');
Example #15
0
            }
          });
          lineDuplications.push(duplicated ? i + 1 : false);
        });
        line.duplications = lineDuplications;
      });
    }
    this.set({ source });
  },

  checkIfHasDuplications () {
    const source = this.get('source');
    let hasDuplications = false;
    if (source != null) {
      source.forEach(function (line) {
        if (line.duplicated) {
          hasDuplications = true;
        }
      });
    }
    this.set({ hasDuplications });
  },

  hasCoverage (source) {
    return _.some(source, function (line) {
      return line.coverageStatus != null;
    });
  }
});

Example #16
0
function haveSummaryMapsErrors( summaryMaps ) {
    return _.some( summaryMaps, hasSummaryMapErrors );
}
 .then(function (hasGeomValues) {
   return _.some(hasGeomValues);
 });
Example #18
0
function hasSummaryMapErrors( summaryMap ) {
    return _.some( summaryMap, function( summary ) {
        return summary.error;
    } )
}
Example #19
0
 _anyItemsChecked: function () {
     return _.some(this.items);
 },
Example #20
0
  'class': function (tagname, value, target, block) {
    var self = this;
    var fullname, host, parent;

    // set the process and attach the process on `target`
    if (target._raw.process) {
      target.process = utils.fmtProcess(target._raw.process);
    } else {
      var mod = this.modules[this.context.module];
      if (mod) {
        target.process = mod.process;
      }
    }

    if (target._raw.extends) {
      var extended = target._raw.extends;
      if (!extended) {
        console.warn('usage: `@extends <class>`, but only found `@extends`');
      } else if (!this.inheritedMembers.length) {
        this.inheritedMembers.push([extended, value]);
      } else {
        var needNewItem = true;
        var item, at;
        _.some(this.inheritedMembers, function (member) {
          item = member;
          at = member.indexOf(extended);
          if (member.length - 1 === at) {
            return true;  // break
          }
          if (member[at + 1] === value) {
            needNewItem = false;
            return true;
          }
          if (at !== -1) {
            return true;
          }
        }, this);
        if (needNewItem) {
          if (extended !== item[item.length - 1]) {
            var newItem = item.slice(0, at + 1);
            newItem.push(value);
            self.inheritedMembers.push(newItem);
          } else {
            item.push(value);
          }
        }
      }
    }
    
    this.context.clazz = value;

    fullname = this.context.clazz;
    host = this.classes[fullname] || {};
    parent = this.context.module;

    if (parent && host) {
      host.module = parent;
    }

    // set `is_enum` when the tagname is "enum"
    if (tagname === 'enum') {
      host.isEnum = true;
      host.type = 'enums';
    } else {
      host.isEnum = false;
      host.type = 'classes';
    }

    //Merge host and target in case the class was defined in a "for" tag
    //before it was defined in a "class" tag
    host = _.extend(host, target);
    this.classes[fullname] = host;
    parent = this.context.submodule;
    if (parent) {
      host.submodule = parent;
    }

    target.description = host.description;
    return host;
  },
Example #21
0
		this.adminState.agent.findResources(function matchAgents(agent) {
			return _.some(agentIds, function match(id) {
				return agent.id === id;
			});
		}, function agentsThatWeHave(err, agents) {
Example #22
0
var hasSignificantChildren = function (entry) {
  return _.some(children(entry), function (entry) {
    return (entryTime(entry) >= filter);
  });
};
Example #23
0
exports['underscore.some()'] = function () {
  return underscore.some(input, fns());
};
Example #24
0
  forEachAction(callback) {

    // TODO: include "parent" node type actions too
    return _.some(this.actions, callback);
  }
Example #25
0
 var startsWith = function () {
   return _.some(arguments, function (prefix) {
     return inputTrimmed.indexOf(prefix) === 0;
   });
 };
Example #26
0
      _.each(this._worksheet._keys, function (column, key) {
        if (value[key] !== undefined) {
          self._getCell({
            address: colCache.encodeAddress(self._number, column.number),
            row: self._number,
            col: column.number
          }).value = value[key];
        }
      });
    }
  },

  // returns true if the row includes at least one cell with a value
  get hasValues() {
    return _.some(this._cells, function (cell) {
      return cell.type != Enums.ValueType.Null;
    });
  },

  // get the min and max column number for the non-null cells in this row or null
  get dimensions() {
    var min = 0;
    var max = 0;
    _.each(this._cells, function (cell) {
      if (cell.type != Enums.ValueType.Null) {
        if (!min || (min > cell.col)) {
          min = cell.col;
        }
        if (max < cell.col) {
          max = cell.col;
        }
Example #27
0
 _(raw.types).each(function (o) {
     if (_.some(VALID_TYPES, function (vt) {vt.code === o})) {
         collected.push(o);
     }
 });
Example #28
0
Stage.prototype.somePlayer = function(func) {
	return _.some(_.keys(this.players), function(key){
		return func.call(this, this.players[key]);
	}.bind(this));
};
Example #29
0
     */
    createRelated(relation, val, constructor, options) {
        return new constructor(val, options);
    },
     /**
     * Shorthand for getting nested attributes.
     *
     * @param {string} key Attribute name in dot notation.
     * @return {mixed} The value of key if found, undefined otherwise.
     */
    dot(key) {
        if (typeof key !== 'string') {
            return undefined;
        }

        const keys = key.trim('.').split('.');
        let result = this;

        _.some(keys, (anotherKey) => {
            if (result && typeof result.get === 'function') {
                result = result.get(anotherKey);
                return false;
            }
            result = undefined;
            return true;
        });

        return result;
    },
});
 missingUniversalPrimer: function(reverse = false) {
   return !_.some(this.getProducts(), function(product) {
     return (reverse ? /Rvs Cap/ : /Fwd Anchor/).test(product.primer.name);
   });
 },