Reiterate is submitted!
Your script is now in the approval queue. After a quick review we will notify you of the script's status by email. If everything's alright, we'll publish your work to the site and rss feed. Otherwise, we'll send you the email explaining what seems questionable. In that case, reply to the email whenever we should review the script again.
Also, don't hesitate to discuss things if you feel that our reasons are unfair. We are real folk, and we don't like bureaucracy. : )
Thank you for your contribution!
1
If you’re familiar with Ruby and Rails, you probably know all about Symbol#to_proc and Methodphitamine. I wanted some similar goodness for Prototype, so I could stop writing
var value = radioGroup.find(function(radio) {
return radio.checked;
}).value;
var divs = someDivs.findAll(function(div) {
return div.hasClassName('myClass')
&& div.visible();
});
and instead write
var value = radioGroup.find('checked').value;
var divs = someDivs.findAll({
hasClassName: 'myClass',
visible: true
});
So I went about writing it. It started off with a simple patch over at Rails Trac that extended the idea behind Enumerable#pluck to lots of other methods, but then I got carried away. You can now use strings, arrays and hashes instead of iterator functions to make your code more readable.
- Website:
-
Reiterate
- Author:
-
James Colgan
- Size:
- 5 KB
- Last modified:
- 11/30/2007
- License:
-
n/a
- Tags:
- syntactic sugar
- Rating:
-
2
(2/5 from 1 vote)
- Your rating:
-
0
Not yet rated
- Please sign in or register to rate this script
- You can't rate your own script.