I've got:
const fs = require('fs');
const packageConfig = JSON.parse(fs.readFileSync('./package.json'));
const { jspm: { configFile: jspmConfigFile }} = packageConfig;
but packageConfig's value for configFile could be undefined. In that case, I'd like to default jspmConfigFile to 'config.js
Is it possible to do this without creating an extended packageConfig object?
I realize I could do something like:
const { jspm: { configFile: jspmConfigFile }} = _.extend({
jspm: { config: 'config.js'}
}, packageConfig);
but that's pretty messy just to get a sensible default with destructuring.
What am I missing?
const jspmConfigFile = packageConfig.jspm.configFile || 'config.js';?