Tag:extjs4 Source function object boolean
/** * Returns True if the passed value is empty, false otherwise. The value is deemed to being empty if it is either: * *-' null ' *-' undefined ' *-a zero-l Ength Array *-a zero-length string (unless the ' allowemptystring ' parameter is set to ' true ') * * @param {Object} value the value to test * @param {Boolean} allowemptystring (optional) True to allow empty Strin GS (defaults to False) * @return {Boolean} * @markdown */isempty:function (value, allowemp tystring) {return (value = = null) | | (value = = undefined) | | (!allowemptystring? value = = = ': false) | | (Ext.isarray (value) && value.length = = = 0); },/** * Returns True if the passed value is a JavaScript Array, false otherwise. * * @param {Object} target the target to test * @return {Boolean} * @method */isAr Ray: (' IsArray ' in ArraY)? Array.isArray:function (value) {return Tostring.call (value) = = = ' [Object Array] '; },/** * Returns True if the passed value is a JavaScript Date object, False otherwise. * @param {Object} object the object to test * @return {Boolean} */Isdate:function (value) { return Tostring.call (value) = = = ' [Object Date] '; },/** * Returns True if the passed value is a JavaScript Object, false otherwise. * @param {Object} value the value to test * @return {Boolean} * @method */isobject: (tostr Ing.call (NULL) = = = ' [Object Object] ')? function (value) {//check ownerdocument here as ' well ' to exclude DOM nodes return value!== null &am p;& value!== undefined && tostring.call (value) = = = ' [Object Object] ' && value.ownerdocument = = = Undef ined; }: Function (value) {return Tostring.call (value) = = = ' [Object Object] '; },/** * @private * */issimpleobject:function (value) {return value instanceof Ob ject && Value.constructor = = = Object; },/** * Returns True if the passed value is a JavaScript ' primitive ', a string, number or Boolean. * @param {Object} value the value to test * @return {Boolean} */Isprimitive:function (value) { var type = typeof value; return type = = = ' String ' | | Type = = = ' Number ' | | Type = = = ' Boolean '; },/** * Returns True if the passed value is a JavaScript Function, false otherwise. * @param {Object} value the value to test * @return {Boolean} * @method */isfunction: Safari 3.x and 4.x returns ' function ' for typeof <nodelist>, hence we need to fall back to using//OBJ Ect.prototype.toString (slower) (typeof document!== ' undefined ' && typeof document.getElementsByTagName (' body ') = = = ' function ')? function (value) {return Tostring.call (value) = = = ' [Object Function] '; }: Function (value) {return typeof value = = = ' function '; },/** * Returns True if the passed value is a number. Returns false for Non-finite numbers. * @param {Object} value the value to test * @return {Boolean} */Isnumber:function (value) { return typeof value = = = ' Number ' && isfinite (value); },/** * Validates that a value is numeric. * @param {Object} value examples:1, ' 1 ', ' 2.34 ' * @return {Boolean} True if numeric, false otherwise */ Isnumeric:function (value) {return!isnan (parsefloat (value)) && isfinite (value); },/** * Returns True if the passed value is a string. * @param {Object} value the value to test * @return {Boolean} */isstring:function (value) {return typeof value = = = ' String '; },/** * Returns True if the passed value is a Boolean. * * @param {Object} value the value to test * @return {Boolean} */Isboolean:function (Valu e) {return typeof value = = = ' Boolean '; },/** * Returns True if the passed value is a htmlelement * @param {Object} value the value to TE St * @return {Boolean} */Iselement:function (value) {return value? value.nodetype = = = 1:false; },/** * Returns True if the passed value is a textnode * @param {Object} value the value to test * @return {Boolean} */Istextnode:function (value) {return value? value.nodename = = = "# Text ": false; },/** * Returns True if the passed value is defined. * @param {Object} value the value to test * @return {Boolean} */Isdefined:function (value) {return typeof value!== ' undefined ' ; },/** * Returns True if the passed value is iterable, False otherwise * @param {Object} value the Value to test * @return {Boolean} */Isiterable:function (value) {var type = typeof Val UE, checklength = false; if (value && type! = ' string ') {//Functions has a length property, so we need to the filter them out if (type = = ' function ') {//in Safari, nodelist/htmlcollection both return "function" When using the TypeOf, so we need//to explicitly check them here. if (Ext.issafari) {checklength = value instanceof NodeList | | value instanceof htmlcollection; }} else {checklength = true; } } return checklength? Value.length!== Undefined:false; }
extjs--15--ext.is* various types of judgment method, simple look at the source code can understand