postaljs/postal.js — pull request #51 by webpro (2013-10-07 20:14:35+00:00)
Title: Removing Underscore

This PR is a starting point to remove the Underscore dependency. Here's what I did so far:

* Some "free" converts, e.g. `typeof func === 'function` over `_.isFunction`, or `for..in` where possible.
* Converted to use native methods `isArray`, `forEach`, `map` and `bind`; added Shim.js for legacy environments.
* Added `Util.js` with some Underscore/Lo-Dash methods (sources are included in comments).
* Removed `underscore.js` as postal.js dependency, and from specs.

Note that I've added a very simple `_.isEqual` method. The tests still pass, but it may very well be not expected behavior for some users:

_.isEqual = function ( a, b ) {
return JSON.stringify( a ) === JSON.stringify( b )
};

Added file size for Shim/Util combined is currently 3.5k (minified).

Alternatively, `Shim.js` and `Util.js` can be replaced with a custom build of Lo-Dash (10k minified). Though it has compatibility issue with postal/the specs for `_.throttle`. The command to build Lo-Dash I've used:

$ lodash include=isNaN,isEqual,clone,isEmpty,all,debounce,throttle,after

Also see #21.

What do you think? Would you consider pushing this through together?