-
Sean Hammond authored
annotator.config.settings currently exports an object containing individual standalone functions for returning different settings' values: module.exports = { app: appFunction, annotations: annotationsFunction, ... }; Change it to export just a single constructor function - settingsFrom() - that returns an object containing the previously-exported functions as methods: function settingsFrom(window_) { ... return { get app() { return app(); }, get annotations() { return annotations(); }, ... }; } module.exports = settingsFrom; Note that ES5 getters are used so that, even though app() and annotations() are methods rather than simple properties now, they can still be accessed as properties - settings.app not settings.app(). This makes the code that uses this object slightly simpler, and makes mocking this object in unit tests simpler. The diff of this commit looks big, because the indentation of a lot of code is changed, but it really is just changing functions into methods and not actually changing the code of any of those functions. The reason for turning functions into an object with methods is so that the object that settingsFrom() returns can have state (by having closure variables inside the settingsFrom() function). We don't make any use of this state yet but future commits will do.
ae3e804a