日期:2014-05-16 浏览次数:20625 次
Object.prototype.copy=function(extendObj){
if(!App.isObject(this))throw {message:'对象不支持此属性或方法'};
if(App.isObject(extendObj))for(var p in extendObj)this[p]=extendObj[p];
}
Object.prototype.copyIf=function(extendObj){
if(!App.isObject(this))throw {message:'对象不支持此属性或方法'};
if(App.isObject(extendObj))for(var p in extendObj)if(App.isUndefined(this[p]))this[p]=extendObj[p];
}
String.prototype.trim=function(){return this.replace(/^\s+|\s+$/g,'')};
var App={
_getType:function(v){return Object.prototype.toString.apply(v)},
getType:function(v){if(v===undefined)return '[object Undefined]';else if(v===null)return '[object Null]';return App._getType(v)},
isFunction:function(v){return App._getType(v)==='[object Function]'},
isObject:function(v){return App._getType(v)==='[object Object]'},
isArray:function(v){return App._getType(v)==='[object Array]'},
isDate:function(v){return App._getType(v)==='[object Date]'},
isString:function(v){return App._getType(v)==='[object String]'},
isBoolean:function(v){return App._getType(v)==='[object Boolean]'},
isNumber:function(v){return App._getType(v)==='[object Number]'},
isInt:function(v){return App.isNumber(v) && (v+'').indexOf('.')<0},
isUndefined:function(v){return v===undefined},
isNull:function(v){return v===null},
isBlankString:function(v){return App.isString(v) && v.trim().length==0},
isNotBlankString:function(v){return App.isString(v) && v.trim().length>0},
isEmptyObject:function(v){return App.isOb