When making any kind of CLI tool, or project with node.js I am often faced with a situation in witch I need to merge down two or more objects into one, and do so recursively. Although there might be a method in a framework I am using, or maybe even something native that is getting added in, to help with this, and just this I have quickly found that the npm package object-merge works great for this.
Because it is an npm package I can get started with it my just typing npm install as always.
The situation I get in often involves having an object that contains hard coded default values, values that are parsed from the command line using something like nopt, and maybe even some values from a json file.
As such I might want my CLI tool to treat what is given from the command line as what comes first and foremost, then fall back to what is in JSON, and finally go with what is hard coded last to make an options object that contains the actual set of options that will be used.
Thats it for now, it seems like object-merge is a solid solution from merging down one or more objects, but I would not say it is the end all be all.