amd-utils : modular JavaScript utilities

Last week I decided to split some of my personal JavaScript code into individual modules to provide an easy way of loading only what is really necessary and increase code reuse between multiple projects/libraries. The purpose isn’t to replace Dojo, jQuery, YUI, Mootools, etc, but to provide modular solutions for common problems that aren’t solved by most of them and to avoid using a full library when you only need a small subset of features.

The project is on github and I will keep adding new features as needed, there is still a lot of stuff to be ported from my legacy JS/PHP/AS3 code and also to be coded from scratch…

Documentation is on a README.mdown file inside each folder and modules are grouped by type. I still didn’t had time to generate HTML files for the docs but Github already displays them nicely (that’s why I named each file as README). Take a look at the String and Math utilities - lots of gems in there - I’ve been using those functions on most of my projects and some of them are very useful. Also take a look at the unit tests if you have any doubt about how a certain method works and what it is supposed to do.

I will try to keep the code as clean as possible and write it on a way that it is easy to extract and edit if needed - right now it is very easy to write a parser to convert the modules to any other format or extract methods manually since I’m using named functions everywhere and modules follows a common structure.

I’ll favor clean code over performance and/or file size almost all the times but that doesn’t mean the code is slow by any mean… Also note that minifiers like Google Closure Compiler and UglifyJS will make sure code is as small/optimized as possible. Code should be readable to humans, not only machines.

The project is released under the MIT license.

watch it, fork it, share it…

PS: I know a lot of people will think that dead code removal should be done automatically by compilers/minifiers, and I agree with that till a certain extent, but JS is a very dynamic language and sometimes those tools can’t easily find out what needs to be removed, specially if some files needs to be lazy-loaded. It’s a controversial subject and it’s totally fine if you have a different opinion… for the kind of stuff I’m building I think it is the “best” approach tho.