prettier/src/options.js

24 lines
677 B
JavaScript
Raw Normal View History

var defaults = {
2017-01-10 07:22:58 +03:00
// Number of spaces the pretty-printer should use per tab
tabWidth: 2,
2017-01-10 07:22:58 +03:00
// Fit code within this line limit
printWidth: 80,
2017-01-05 18:01:43 +03:00
// If true, will use single instead of double quotes
singleQuote: false,
2017-01-10 07:22:58 +03:00
// Controls the printing of trailing commas wherever possible
trailingComma: false,
// Controls the printing of spaces inside array and objects
bracketSpacing: true
};
// Copy options and fill in default values.
exports.normalize = function(options) {
const normalized = Object.assign({}, options);
Object.keys(defaults).forEach(k => {
2017-01-13 23:03:53 +03:00
if (normalized[k] == null) {
normalized[k] = defaults[k];
}
});
return normalized;
};