How to use the spm-jquery.isFunction 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 Rule(name, oper) {
    var self = this;

    self.name = name;

    if (oper instanceof RegExp) {
        self.operator = function (opts, commit) {
            var rslt = oper.test($(opts.element).val());
            commit(rslt ? null : opts.rule, _getMsg(opts, rslt));
        };
    } else if ($.isFunction(oper)) {
        self.operator = function (opts, commit) {
            var rslt = oper.call(this, opts, function (result, msg) {
                commit(result ? null : opts.rule, msg || _getMsg(opts, result));
            });
            // 当是异步判断时, 返回 undefined, 则执行上面的 commit
            if (rslt !== undefined) {
                commit(rslt ? null : opts.rule, _getMsg(opts, rslt));
            }
        };
    } else {
        throw new Error('The second argument must be a regexp or a function.');
    }
}
github aralejs / validator / src / item.js View on Github external
setter: function (val) {
        return $.isFunction(val) ? val : utils.helper(val);
    }
};
github aralejs / validator / src / item.js View on Github external
setup: function () {
        if (!this.get('display') && $.isFunction(this.get('displayHelper'))) {
            this.set('display', this.get('displayHelper')(this));
        }
    },

spm-jquery

JavaScript library for DOM operations

MIT
Latest version published 9 years ago

Package Health Score

69 / 100
Full package analysis