How to use the jquery.isArray function in jquery

To help you get started, we’ve selected a few jquery examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github galaxyproject / galaxy / client / galaxy / scripts / mvc / tool / tool-form-composite.js View on Github external
_templateSuccess: function(response) {
        const Galaxy = getGalaxyInstance();
        if ($.isArray(response) && response.length > 0) {
            let timesExecuted = "";
            // Default destination blurb, used for a single execution, same history.
            let destinationBlurb =
                "You can check the status of queued jobs and view the resulting data by refreshing the History pane, if this has not already happened automatically.";
            const newHistoryTarget =
                (response[0].history_id &&
                    Galaxy.currHistoryPanel &&
                    Galaxy.currHistoryPanel.model.id != response[0].history_id) ||
                false;
            if (response.length > 1) {
                // Executed more than one time, build blurb but skip history link.
                timesExecuted = `<em> - ${response.length} times</em>`;
                if (newHistoryTarget) {
                    destinationBlurb = `This workflow will generate results in multiple histories.  You can observe progress in the <a href="${getAppRoot()}history/view_multiple">history multi-view</a>.`;
                }
            } else if (newHistoryTarget) {
github Esri / storymap-crowdsource / src / app / components / forms / base / FormGroup.babel.js View on Github external
const validations = this.props.validations && $.isArray(this.props.validations) ? this.props.validations.slice(0) : [];
    const type = (this.props.inputAttr && this.props.inputAttr.type) ? this.props.inputAttr.type : 'text';

    const addToValidations = function addToValidations(validation) {
      if (validation && $.inArray(validation.rule,validations) === -1 && $.grep(validations,(val) => {
        if (typeof val === 'object' && val.rule && val.rule === validation.rule) {
          return true;
        } else {
          return false;
        }
      }).length === 0) {
        validations.push(validation);
      }
    };

    if (this.defaultValidations && $.isArray(this.defaultValidations)) {
      $.each(this.defaultValidations,(index) => {
        addToValidations(this.defaultValidations[index]);
      });
    }

    if (this.props.inputAttr && typeof this.props.inputAttr === 'object') {
      $.each(this.props.inputAttr,(key,value) => {
        let validation = false;

        // TODO add all validations http://www.w3schools.com/tags/tag_input.asp
        switch (key.toLowerCase()) {
          case 'required':
            if (value) {
              validation = {
                rule: 'required'
              };
github cockpit-project / cockpit / pkg / lib / patterns.js View on Github external
function display_errors(sel, errors) {
    clear_errors(sel);

    /* The list of errors can also be passed as an array */
    if (errors.length == 1 && $.isArray(errors[0]))
        errors = errors[0];

    var any = false;
    errors.forEach(function(error) {
        var target;
        if (error) {
            target = sel.find(error.target);

            /* Errors for a specific field added below that field */
            if (target && target.length)
                field_error(target, error);
            else
                global_error(sel, error);

            any = true;
        }
github apache / incubator-echarts-doc / test / vendors / dt / 0.0.1 / lib / dataDriven.js View on Github external
lib.obArray = function (v) {
        base.assert(v === UNDEFINED || $.isArray(v));
        var o = lib.ob(v || []);
        base.assign(o, obArrayMethods);

        o[OB_TYPE_PROP] = 'obArray';
        return o;
    };
github aralejs / autocomplete / src / autocomplete.js View on Github external
function locateResult(locator, data) {
  if (locator) {
    if ($.isFunction(locator)) {
      return locator.call(this, data);
    } else if (!$.isArray(data) && isString(locator)) {
      var s = locator.split('.'),
          p = data;
      while (s.length) {
        var v = s.shift();
        if (!p[v]) {
          break;
        }
        p = p[v];
      }
      return p;
    }
  }
  return data;
}
github gsantiago / jquery-view / src / Template2.js View on Github external
var values = $.map(data, function (val, key) {
    if ($.isArray(val)) return [val]
    return val
  })
github Esri / storymap-crowdsource / src / app / components / forms / base / FormGroup.babel.js View on Github external
getValidations() {
    const validations = this.props.validations && $.isArray(this.props.validations) ? this.props.validations.slice(0) : [];
    const type = (this.props.inputAttr && this.props.inputAttr.type) ? this.props.inputAttr.type : 'text';

    const addToValidations = function addToValidations(validation) {
      if (validation && $.inArray(validation.rule,validations) === -1 && $.grep(validations,(val) => {
        if (typeof val === 'object' && val.rule && val.rule === validation.rule) {
          return true;
        } else {
          return false;
        }
      }).length === 0) {
        validations.push(validation);
      }
    };

    if (this.defaultValidations && $.isArray(this.defaultValidations)) {
      $.each(this.defaultValidations,(index) => {
github ecomfe / echarts-www / vendors / dt / 0.0.1 / lib / base.js View on Github external
lib.onlyHasProperty = function (obj, property) {
        var ret = true;
        if (property == null) {
            return false;
        }
        if (!$.isArray(property)) {
            property = [property];
        }
        for (var key in obj) {
            if (obj.hasOwnProperty(key) && lib.arrayIndexOf(property, key) === -1) {
                ret = false;
            }
        }
        return ret;
    };
github liuyunzhuge / blog / form / dist / js / mod / formValidation2.js View on Github external
showErrors: function (errorMap, errorList) {
                            var successList = this.successList,
                                config = opts.config;

                            if ($.isArray(errorList)) {
                                errorList.forEach(function (item) {
                                    var $field = $(item.element),
                                        msg = item.message,
                                        name = $field.attr('name') || $field.data('name'),
                                        $tipTarget = $field,
                                        type = $field.data('fvType') || $field.attr('type'),
                                        tipPlacement = opts.tipPlacement,
                                        tooltipClass = '';

                                    if (name in config) {
                                        if (isFunc(config[name].fvTipTarget)) {
                                            //$tipTarget是用来显示校验提示的元素
                                            //默认是字段元素本身
                                            //但是对于部分场景下,可能用父元素来显示提示更合适
                                            //所以通过fvTipTarget由外部来指定
                                            $tipTarget = config[name].fvTipTarget($field);
github Esri / storymap-crowdsource / src / app / controllers / user / User.babel.js View on Github external
userPermissions.contributor = true;
    } else if (portal.getPortalUser()) {
      userPermissions.contributor = true;
    }

    if (settings.guestContributor) {
      userPermissions.contributor = true;
    }

    if (lang.getObject('appState.user.contributor',false,this) !== userPermissions.contributor || lang.getObject('appState.user.editor',false,this) !== userPermissions.editor || lang.getObject('appState.user.publisher',false,this) !== userPermissions.publisher) {
      UserActions.authenticateUser(userPermissions);
    } else if (settings.forceAuthenticate) {
      UserActions.authenticateUser(userPermissions);
    }

    if (!this.authorizedOwnersChecked && !$.isArray(authorizedOwners) || authorizedOwners.length === 0) {
      this.authorizedOwnersChecked = true;
      AppActions.displayMainError(viewerText.errors.loading.unspecifiedConfigOwner);
    } else if (!this.authorizedOwnersChecked && lang.getObject('appState.mode.isBuilder',false,this) && portalUser && authorizedOwners.indexOf(portalUser) === -1 && authorizedOwners.indexOf('*')) {
      this.authorizedOwnersChecked = true;
      AppActions.displayMainError(viewerText.errors.loading.invalidConfigOwner);
    } else if (!this.authorizedOwnersChecked && appOwner && authorizedOwners.indexOf(appOwner) === -1 && authorizedOwners.indexOf('*')) {
      this.authorizedOwnersChecked = true;
      AppActions.displayMainError(viewerText.errors.loading.invalidConfigOwner);
    }
  }