现有JS对象方法的扩展 - Sugar.js

fmms 12年前

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() + '.';  });

现有JS对象方法的扩展 - Sugar.js

项目主页:http://www.open-open.com/lib/view/home/1329632880390