Javascript Array has(el)

Description

Javascript Array has(el)


Array.prototype.has = function (el) {
    return this.indexOf(el) > -1;
};

var isEmpty = function (value) {
    if (value == null || value == undefined) {
        return false;
    }/* w ww . ja  v a2  s.  c  o  m*/
    var v = value.replace(/(^\s*)|(\s*$)/g, '');
    return v.length == 0;
};
var isDigit = function (value) {
    if (value == null || value == undefined) {
        return false;
    }
    var v = value.toString().replace(/(^\s*)|(\s*$)/g, '');
    var re = /^\d+$/g;
    return re.test(v);
};
var isPrice = function (value) {
    if (value == null || value == undefined) {
        return false;
    }
    var re = /^\d+\.{0,1}\d*$/g;
    return re.test(value);
};



PreviousNext

Related