UNPKG

@fisker/prettier-config

Version:

fisker's Shareable prettier Configuration

55 lines (42 loc) 1.02 kB
import defaults from './default-config.js' import defineProperties from './utils/define-properties.js' class Configuration { constructor(options = {}) { this.options = options } extend(customize = {}) { const {options} = this const {overrides = []} = options const {overrides: customizeOverrides = []} = customize const extended = { ...options, ...customize, overrides: [...overrides, ...customizeOverrides], } return getConfig(extended) } get config() { const {options} = this const {overrides = []} = options const config = { ...options, } if (overrides.length !== 0) { config.overrides = [...overrides] } const {extend} = Configuration.prototype return defineProperties( config, { extend: extend.bind(this), }, { enumerable: false, }, ) } } function getConfig(options = defaults) { return new Configuration(options).config } export default getConfig