Tiny update: after adding 16 characters (“this._object || “), Reiterate is now compatible with Prototype 1.6.0′s revised Hash API. Also, the gzipped copy is now even smaller, thanks to a different compression strategy. Essentially, when using Packer (or PackR for that matter), using ‘shrink variables’ plus gzip compression will result in the smallest an fastest-to-execute [...]
You know how, in Ruby, + is a method? Well guess what: // Count members within a range numbers.findAll({‘>’: 4, ‘<=’: 27}).length // Remove items of a specific type collection.reject(['instanceof', String]) // Assign default values to a collection [27, 0, 'prototype', '', true, false].map({‘||’: ‘foo’}) // -> [27, "foo", "prototype", "foo", true, "foo"] How’s about [...]
Following on from yesterday’s post, I went a little crazy and expanded the idea of #toFunction to Array and Hash. The end result is Reiterate, which gives you a stack of neat ways to make your JavaScript code more concise and expressive. For example: var strings = array.map(‘toLowerCase.toArray’); var divs = someDivs.findAll({hasClassName: ‘myClass’, visible: true}); [...]
© The If Works. Powered by WordPress using the DePo Skinny Theme.