How to use the alloy/underscore._.isArray function in alloy

To help you get started, we’ve selected a few alloy 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 BOXOUT-THINKERS / TiOpenChat / app / lib / alloy / sync / sqlrest.js View on Github external
sql += ' UNION ' + _buildQuery(opts.union);
  }
  if (opts.unionAll) {
    sql += ' UNION ALL ' + _buildQuery(opts.unionAll);
  }
  if (opts.intersect) {
    sql += ' INTERSECT ' + _buildQuery(opts.intersect);
  }
  if (opts.except) {
    sql += ' EXCEPT ' + _buildQuery(opts.EXCEPT);
  }

  // group by, order by and limit should be in the end of the statement
  if (opts.groupBy) {
    var group;
    if (_.isArray(opts.groupBy)) {
      group = opts.groupBy.join(', ');
    } else {
      group = opts.groupBy;
    }

    sql += ' GROUP BY ' + group;
  }
  if (opts.orderBy) {
    var order;
    if (_.isArray(opts.orderBy)) {
      order = opts.orderBy.join(', ');
    } else {
      order = opts.orderBy;
    }

    sql += ' ORDER BY ' + order;
github BOXOUT-THINKERS / TiOpenChat / app / lib / alloy / sync / sqlrest.js View on Github external
where = [];
      where = whereBuilder(where, opts.where);
      where = where.join(' AND ');
    } else {
      where = opts.where;
    }

    sql += ' WHERE ' + where;
  } else {
    sql += ' WHERE 1=1';
  }

  // WHERE NOT
  if (opts.wherenot && !_.isEmpty(opts.wherenot)) {
    var wherenot;
    if (_.isArray(opts.wherenot)) {
      wherenot = opts.wherenot.join(' AND ');
    } else if ( typeof opts.wherenot === 'object') {
      wherenot = [];
      // use the where not operator
      wherenot = whereBuilder(wherenot, opts.wherenot, " != ");
      wherenot = wherenot.join(' AND ');
    } else {
      wherenot = opts.wherenot;
    }

    sql += ' AND ' + wherenot;
  }

  // LIKE
  if (opts.like) {
    var like;
github viezel / napp.alloy.adapter.restsql / sqlrest.js View on Github external
}

	// group by, order by and limit should be in the end of the statement
	if (opts.groupBy) {
		var group;
		if (_.isArray(opts.groupBy)) {
			group = opts.groupBy.join(', ');
		} else {
			group = opts.groupBy;
		}

		sql += ' GROUP BY ' + group;
	}
	if (opts.orderBy) {
		var order;
		if (_.isArray(opts.orderBy)) {
			order = opts.orderBy.join(', ');
		} else {
			order = opts.orderBy;
		}

		sql += ' ORDER BY ' + order;
	}
	if (opts.limit) {
		sql += ' LIMIT ' + opts.limit;
		if (opts.offset) {
			sql += ' OFFSET ' + opts.offset;
		}
	}

	return sql;
}
github viezel / napp.alloy.adapter.restsql / sqlrest.js View on Github external
where = [];
			where = whereBuilder(where, opts.where);
			where = where.join(' AND ');
		} else {
			where = opts.where;
		}

		sql += ' WHERE ' + where;
	} else {
		sql += ' WHERE 1=1';
	}

	// WHERE NOT
	if (opts.wherenot && !_.isEmpty(opts.wherenot)) {
		var wherenot;
		if (_.isArray(opts.wherenot)) {
			wherenot = opts.wherenot.join(' AND ');
		} else if ( typeof opts.wherenot === 'object') {
			wherenot = [];
			// use the where not operator
			wherenot = whereBuilder(wherenot, opts.wherenot, " != ");
			wherenot = wherenot.join(' AND ');
		} else {
			wherenot = opts.wherenot;
		}

		sql += ' AND ' + wherenot;
	}

	// LIKE
	if (opts.like) {
		var like;
github BOXOUT-THINKERS / TiOpenChat / app / lib / alloy / sync / sqlrest.js View on Github external
}

  // group by, order by and limit should be in the end of the statement
  if (opts.groupBy) {
    var group;
    if (_.isArray(opts.groupBy)) {
      group = opts.groupBy.join(', ');
    } else {
      group = opts.groupBy;
    }

    sql += ' GROUP BY ' + group;
  }
  if (opts.orderBy) {
    var order;
    if (_.isArray(opts.orderBy)) {
      order = opts.orderBy.join(', ');
    } else {
      order = opts.orderBy;
    }

    sql += ' ORDER BY ' + order;
  }
  if (opts.limit) {
    sql += ' LIMIT ' + opts.limit;
    if (opts.offset) {
      sql += ' OFFSET ' + opts.offset;
    }
  }

  return sql;
}
github bob-sims / ytPlayer / Resources / alloy.js View on Github external
exports.createStyle = function(controller, opts, defaults) {
    var classes, apiName;
    if (!opts) return {};
    classes = _.isArray(opts.classes) ? opts.classes.slice(0) : _.isString(opts.classes) ? opts.classes.split(/\s+/) : [];
    apiName = opts.apiName;
    apiName && -1 === apiName.indexOf(".") && (apiName = addNamespace(apiName));
    var styleArray;
    styleArray = controller && _.isObject(controller) ? require("alloy/widgets/" + controller.widgetId + "/styles/" + controller.name) : require("alloy/styles/" + controller);
    var styleFinal = {};
    var i, len;
    for (i = 0, len = styleArray.length; len > i; i++) {
        var style = styleArray[i];
        var styleApi = style.key;
        style.isApi && -1 === styleApi.indexOf(".") && (styleApi = (CONST.IMPLICIT_NAMESPACES[styleApi] || CONST.NAMESPACE_DEFAULT) + "." + styleApi);
        if (style.isId && opts.id && style.key === opts.id || style.isClass && _.contains(classes, style.key)) ; else {
            if (!style.isApi) continue;
            -1 === style.key.indexOf(".") && (style.key = addNamespace(style.key));
            if (style.key !== apiName) continue;
        }
        if (style.queries && style.queries.formFactor && !Alloy[style.queries.formFactor]) continue;
github appcelerator / titanium_mobile_windows / Examples / Corporate / src / Assets / alloy.js View on Github external
target = arguments[1] || {};
        i = 2;
    }
    "object" == typeof target || _.isFunction(target) || (target = {});
    for (;length > i; i++) {
        options = arguments[i];
        if (null != options) {
            "string" == typeof options && (options = options.split(""));
            for (name in options) {
                src = target[name];
                copy = options[name];
                if (target === copy) continue;
                if (deep && copy && _.isObject(copy) && ((copy_is_array = _.isArray(copy)) || !_.has(copy, "apiName"))) {
                    if (copy_is_array) {
                        copy_is_array = false;
                        clone = src && _.isArray(src) ? src : [];
                    } else clone = _.isDate(copy) ? new Date(copy.valueOf()) : src && _.isObject(src) ? src : {};
                    target[name] = deepExtend(deep, clone, copy);
                }
                target[name] = copy;
            }
        }
    }
    return target;
}
github BOXOUT-THINKERS / TiOpenChat / app / lib / alloy / sync / sqlrest.js View on Github external
_.each(data, function(v, f) {
    if (_.isArray(v)) {//select multiple items
      var innerWhere = [];
      _.each(v, function(value) {
        innerWhere.push(f + whereOperator + _valueType(value));
      });
      where.push(innerWhere.join(' OR '));
    } else if (_.isObject(v)) {
      where = whereBuilder(where, v, whereOperator);
    } else {
      where.push(f + whereOperator + _valueType(v));
    }
  });
  return where;