
js-lang
iteye_2245
这个作者很懒,什么都没留下…
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
常用工具判断-isArray
判断对象是否是array 先看看prototype 1.6.0 isArray:function(obj){ return obj && obj.constructor === Array; } 整理版本: /* *isArray-judge the source is or not an arr...2011-10-20 10:07:26 · 159 阅读 · 0 评论 -
常用工具判断-isFunction
判断对象是否是function 先看看prototype 1.6.0 isFunction:function(obj){ return typeof obj == "function"; } /* *isFunction-judge the source is or not function* *@function* *@...2011-10-21 10:21:30 · 312 阅读 · 0 评论 -
常用工具判断-isBoolean
这个api基本上所有的api框架多是一样的书写方式tangram/YUI /* *isBoolean* *@function* *@param source* *@return {boolean}* */ ZYC.lang.isBoolean = function(source){ return typeof source === "boolean"; ...2011-10-21 14:27:17 · 447 阅读 · 0 评论 -
部分工具类函数整理
这个api在kissy以及YUI,underscore都是相似的 isNull:function(o){ return o === null; } isUndefined:function(o){ return typeof o === 'undefined'; } nullOrUndefined:func...2012-01-17 11:12:10 · 99 阅读 · 0 评论 -
关于各大框架的isElement的整理比较
api的设计要求是判断参数是否为Element对象。 首先我们看看各大开源框架的源码: 1、prototype 1.6.0 isElement: function(o){ return o && o.nodeType == 1; } 2、underscore isElement:function(obj){ ...2012-03-02 17:33:37 · 380 阅读 · 0 评论 -
关于各大框架的判断是否是Date对象
api设计用途是判断参数是否是Date对象。 1、extJs 3.1.0的写法: isDate: function(o){ return Object.prototype.toString.apply(o) === '[object Date]'; } 2、tangram的写法: isDate: function(o){ ...2012-03-02 17:59:13 · 344 阅读 · 0 评论 -
关于各大框架的isNumber的整理比较
api的设计要求是判断源是否是number 首先我们看看各大开源框架的源码: 1、prototype 1.6.0 isNumber:function(obj){ return typeof obj == 'number'; } 2、tangram isNumber:function(source){ return '[obj...2012-03-08 13:48:47 · 145 阅读 · 0 评论 -
isObject判断
本代码片段来自underscore isObject:function(obj){ return obj === Object(obj); } 补充一下tangram的代码设计: //1.5.0 baidu.lang.isObject = function(source){ return typeof source ...原创 2013-02-25 11:38:29 · 932 阅读 · 0 评论