This is the syntax you use to declare functions that are important because of the hoisting function . If you declare these functions as follows, they will be โraisedโ in scope and everything will be fine.
module.exports = { read: read, write: write, }; function read(parameters, config, next) { /* <snip> */ }; function write(parameters, config, next) { /* <snip> */ };
Side note. Named functions like my fragment, unlike anonymous functions assigned to variables like in your fragment, itโs easier to debug the profile, because their name falls into the stack traces.
Peter Lyons
source share