I am currently working on building a pure javascript implementation of the bitcoin blockchain using Node.js for my personal learning experience.I am trying to follow best practices which involve using pure functions as much as possible. This ties into my current goal of keeping my code as testable as possible.How do you keep from functions having to use dependencies declared at the top of a module.?Here is a simplified example of what I mean:// app.jsvar db = require('./database');function checkAndUpdate(newData) { if(newData.update) { db.save(newData); } }
Submitted March 09, 2017 at 08:39PM by eleon182
No comments:
Post a Comment