Change module exporting style
Modules now generally store the exported object in a named variable or function first and only assign |module.exports| at the very end. This is a difference when compared to style used until now, where most modules started with a |module.exports| assignment. I think the explicit name helps readability and understandability.redux
parent
11aab6374f
commit
ff8e877fce
@ -1,9 +1,11 @@
|
|||||||
var utils = require("./utils");
|
var utils = require("./utils");
|
||||||
|
|
||||||
/* Thrown when the grammar contains an error. */
|
/* Thrown when the grammar contains an error. */
|
||||||
module.exports = function(message) {
|
function GrammarError(message) {
|
||||||
this.name = "GrammarError";
|
this.name = "GrammarError";
|
||||||
this.message = message;
|
this.message = message;
|
||||||
};
|
}
|
||||||
|
|
||||||
utils.subclass(module.exports, Error);
|
utils.subclass(GrammarError, Error);
|
||||||
|
|
||||||
|
module.exports = GrammarError;
|
||||||
|
Loading…
Reference in New Issue