How to use the spm-jquery.isPlainObject function in spm-jquery

To help you get started, we’ve selected a few spm-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 aralejs / validator / src / rule.js View on Github external
function _getMsg(opts, b) {
    var ruleName = opts.rule;
    var msgtpl;

    if (opts.message) { // user specifies a message
        if ($.isPlainObject(opts.message)) {
            msgtpl = opts.message[b ? 'success' : 'failure'];
            // if user's message is undefined,use default
            typeof msgtpl === 'undefined' && (msgtpl = messages[ruleName][b ? 'success' : 'failure']);
        } else {//just string
            msgtpl = b ? '' : opts.message
        }
    } else { // use default
        msgtpl = messages[ruleName][b ? 'success' : 'failure'];
    }

    return msgtpl ? compileTpl(opts, msgtpl) : msgtpl;
}
github aralejs / validator / src / rule.js View on Github external
function setMessage(name, msg) {
    if ($.isPlainObject(name)) {
        $.each(name, function (i, v) {
            setMessage(i, v);
        });
        return this;
    }

    if ($.isPlainObject(msg)) {
        messages[name] = msg;
    } else {
        messages[name] = {
            failure: msg
        };
    }
    return this;
}
github aralejs / validator / src / rule.js View on Github external
function setMessage(name, msg) {
    if ($.isPlainObject(name)) {
        $.each(name, function (i, v) {
            setMessage(i, v);
        });
        return this;
    }

    if ($.isPlainObject(msg)) {
        messages[name] = msg;
    } else {
        messages[name] = {
            failure: msg
        };
    }
    return this;
}
github aralejs / validator / src / rule.js View on Github external
function addRule(name, operator, message) {
    if ($.isPlainObject(name)) {
        $.each(name, function (i, v) {
            if ($.isArray(v))
                addRule(i, v[0], v[1]);
            else
                addRule(i, v);
        });
        return this;
    }

    if (operator instanceof Rule) {
        rules[name] = new Rule(name, operator.operator);
    } else {
        rules[name] = new Rule(name, operator);
    }
    setMessage(name, message);

spm-jquery

JavaScript library for DOM operations

MIT
Latest version published 9 years ago

Package Health Score

69 / 100
Full package analysis