一个必用的javascript框架:underscore.js

上篇文章(http://cavenfeng.iteye.com/admin/blogs/1551516)粗略介绍了移动应用框架的搭建,其中,有一个比较重要的库:underscore.js

 

  Underscore是一个非常实用的JavaScript库,提供许多编程时需要的功能的支持,他在不扩展任何JavaScript的原生对象的情况下提供很多实用的功能。

  创造一个小而美的公司非常值得尊敬,小而美的框架同样散发着那样的令人着迷的魅力。

  无论你写一段小的js代码,还是写一个大型的HTML5应用,underscore都能帮上忙。目前,underscore已经被广泛使用,例如,backbone.js唯一强依赖的库就是underscore.js

 

  Underscore提供的60多个函数:

http://www.css88.com/doc/underscore/

 

Collections(集合) 
eachmapreducereduceRightfindfilterrejectallanyincludeinvoke,pluckmaxminsortBygroupBysortedIndexshuffletoArraysize

Arrays(数组) 
firstinitiallastrestcompactflattenwithoutunionintersection,differenceuniqzipindexOflastIndexOfrange

Functions(函数) 
bindbindAllmemoizedelaydeferthrottledebounceonceafterwrap,compose

Objects(对象) 
keysvaluesfunctionsextenddefaultsclonetapisEqualisEmpty,isElementisArrayisArgumentsisFunctionisStringisNumberisBoolean,isDateisRegExpisNaNisNullisUndefined

Utility(功能) 
noConflictidentitytimesmixinuniqueIdescapetemplate

Chaining 
chainvalue

 

 

  具体每个函数的用途,你可以看上面中文的文档(翻译的不是太好),也可以看http://underscorejs.org/

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值