How to use the alloy/underscore._.isString 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 pablorr18 / TiFlexiGrid / Image Gallery Sample / Resources / iphone / alloy.js View on Github external
exports.resetClass = function(controller, proxy, classes, opts) {
    classes = classes || [];
    classes = _.isString(classes) ? classes.split(/\s+/) : classes;
    processStyle(controller, proxy, classes, opts, RESET);
};
github appcelerator / titanium_mobile_windows / Examples / Corporate / src / Assets / alloy.js View on Github external
exports.addClass = function(controller, proxy, classes, opts) {
    if (!classes) {
        if (opts) {
            MW320_CHECK && delete opts.apiName;
            proxy.applyProperties(opts);
        }
        return;
    }
    var pClasses = proxy[CONST.CLASS_PROPERTY] || [];
    var beforeLen = pClasses.length;
    classes = _.isString(classes) ? classes.split(/\s+/) : classes;
    var newClasses = _.union(pClasses, classes || []);
    if (beforeLen === newClasses.length) {
        if (opts) {
            MW320_CHECK && delete opts.apiName;
            proxy.applyProperties(opts);
        }
        return;
    }
    processStyle(controller, proxy, newClasses, opts);
};
github pablorr18 / TiFlexiGrid / Image Gallery Sample / Resources / mobileweb / alloy.js View on Github external
exports.removeClass = function(controller, proxy, classes, opts) {
    classes = classes || [];
    var pClasses = proxy[CONST.CLASS_PROPERTY] || [];
    var beforeLen = pClasses.length;
    if (!beforeLen || !classes.length) {
        if (opts) {
            MW320_CHECK && delete opts.apiName;
            proxy.applyProperties(opts);
        }
        return;
    }
    classes = _.isString(classes) ? classes.split(/\s+/) : classes;
    var newClasses = _.difference(pClasses, classes);
    if (beforeLen === newClasses.length) {
        if (opts) {
            MW320_CHECK && delete opts.apiName;
            proxy.applyProperties(opts);
        }
        return;
    }
    processStyle(controller, proxy, newClasses, opts, RESET);
};
github appcelerator / titanium_mobile_windows / Examples / Corporate / src / Assets / alloy.js View on Github external
exports.resetClass = function(controller, proxy, classes, opts) {
    classes = classes || [];
    classes = _.isString(classes) ? classes.split(/\s+/) : classes;
    processStyle(controller, proxy, classes, opts, RESET);
};
github pablorr18 / TiFlexiGrid / Image Gallery Sample / Resources / android / 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 BOXOUT-THINKERS / TiOpenChat / Resources / iphone / 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 = require(controller && _.isObject(controller) ? "alloy/widgets/" + controller.widgetId + "/styles/" + controller.name : "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 pablorr18 / TiFlexiGrid / Image Gallery Sample / Resources / iphone / alloy / sync / sql.js View on Github external
model.set(attrObj, {
                        silent: true
                    });
                } else Ti.API.warn("Unable to get ID from database for model: " + model.toJSON());
                rs && rs.close();
            }
            db.execute("COMMIT;");
            db.close();
            return model.toJSON();
        }();
        break;

      case "read":
        opts.query && opts.id && Ti.API.warn('Both "query" and "id" options were specified for model.fetch(). "id" will be ignored.');
        sql = "SELECT * FROM " + table;
        opts.query ? sql = opts.query : opts.id && (sql += " WHERE " + (model.idAttribute ? model.idAttribute : ALLOY_ID_DEFAULT) + " = " + (_.isString(opts.id) ? '"' + opts.id + '"' : opts.id));
        db = Ti.Database.open(dbName);
        var rs;
        rs = _.isString(sql) ? db.execute(sql) : db.execute(sql.statement, sql.params);
        var len = 0;
        var values = [];
        while (rs.isValidRow()) {
            var o = {};
            var fc = 0;
            fc = _.isFunction(rs.fieldCount) ? rs.fieldCount() : rs.fieldCount;
            _.times(fc, function(c) {
                var fn = rs.fieldName(c);
                o[fn] = rs.fieldByName(fn);
            });
            values.push(o);
            len++;
            rs.next();
github BOXOUT-THINKERS / TiOpenChat / Resources / iphone / alloy.js View on Github external
exports.createWidget = function(id, name, args) {
    if ("undefined" != typeof name && null !== name && _.isObject(name) && !_.isString(name)) {
        args = name;
        name = DEFAULT_WIDGET;
    }
    return new (require("alloy/widgets/" + id + "/controllers/" + (name || DEFAULT_WIDGET)))(args);
};
github appcelerator / titanium_mobile_windows / Examples / Corporate / src / Assets / alloy.js View on Github external
exports.createWidget = function(id, name, args) {
    if ("undefined" != typeof name && null !== name && _.isObject(name) && !_.isString(name)) {
        args = name;
        name = DEFAULT_WIDGET;
    }
    return new (require("alloy/widgets/" + id + "/controllers/" + (name || DEFAULT_WIDGET)))(args);
};
github pablorr18 / TiFlexiGrid / Image Gallery Sample / Resources / mobileweb / alloy.js View on Github external
exports.createWidget = function(id, name, args) {
    if ("undefined" != typeof name && null !== name && _.isObject(name) && !_.isString(name)) {
        args = name;
        name = DEFAULT_WIDGET;
    }
    return new (require("alloy/widgets/" + id + "/controllers/" + (name || DEFAULT_WIDGET)))(args);
};