Implement require of dependencies for all pad_* modules.

Create a lazily-defined local reference for pad on initialization in each pad module in order to avoid circular dependency. At some point in the future this dependency should instead be injected into each module on initialization.
This commit is contained in:
Chad Weider 2012-01-15 21:37:47 -08:00
parent 7f98116a43
commit fa2a6e9ee6
11 changed files with 62 additions and 5 deletions

View file

@ -34,6 +34,7 @@ var padutils = {
},
uniqueId: function()
{
var pad = require('/pad2').pad; // Sidestep circular dependency
function encodeNum(n, width)
{
// returns string that is exactly 'width' chars, padding with zeros
@ -226,6 +227,7 @@ var padutils = {
},
timediff: function(d)
{
var pad = require('/pad2').pad; // Sidestep circular dependency
function format(n, word)
{
n = Math.round(n);