現有JS對象方法的擴展 - Sugar.js
Sugar 是一個JavaScript庫。它擴展了現有的JS對象的方法,讓你可以用更少的代碼做更多的事情。
- extends native Javascript objects with helpful, intuitive methods.
- adds cross browser functionality when it is broken or missing.
- is entirely test driven from the ground up and includes a massive suite of tests.
- layers in methods when necessary, but defers to native implementations when available.
- enhances Javascript dates and can parse and output a variety of languages.
- plays nicely with other Javascript frameworks and third-party code.
- is simple to understand and easy to use.
- is fully ECMAScript compliant.
getLatestTweets(function(t) { var users = t.map('user').unique(); var total = users.sum('statuses_count').format(); var top = users.max('followers_count').first(); var count = top.followers_count.format(); var since = Date.create(top.created_at); return users.length + ' users with a total of ' + total + ' tweets.\n' + top.screen_name + ' is the top with ' + count + ' followers\n' + 'and started tweeting ' + since.relative() + '.'; });
本文由用戶 fmms 自行上傳分享,僅供網友學習交流。所有權歸原作者,若您的權利被侵害,請聯系管理員。
轉載本站原創文章,請注明出處,并保留原始鏈接、圖片水印。
本站是一個以用戶分享為主的開源技術平臺,歡迎各類分享!