I'm modularizing my client-side JavaScript code with Browserify.
In my "page" module, I'm trying to export an object with methods, like so:
// page.js
exports.picker = {
init: function () { ... },
getValue: function () { ... },
// etc.
};
However, in another module, when I try to use one of these methods, I get a TypeError:
// other module
var page = require('./page');
// later...
page.picker.init(); // throws "TypeError: page.picker is undefined"
Not sure what I'm doing wrong. Is it maybe because I'm exporting an object instead of a function?