- ARCHIVE / Reiterate
- Reiterate 1.3
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 [...]
- Reiterate 1.2: operators are (kind of) methods now!
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 that then? - Announcing Reiterate
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});
More information on [...]