1
0
Fork 0

chore(core): Do not add hide methods to options

This commit is contained in:
Joost De Cock 2022-09-08 11:53:05 +02:00
parent 07b814c254
commit 58c15f6c81
2 changed files with 0 additions and 51 deletions

View file

@ -47,10 +47,6 @@ export function Design(config) {
// Replace config.parts with the resolved config
config.parts = parts
// Ensure all options have a hide() method and menu property
config.options = completeOptions(config.options)
const pattern = function (settings) {
Pattern.call(this, config)
@ -67,25 +63,3 @@ export function Design(config) {
return pattern
}
/*
* A default hide() method for options that lack it
* As this always return false, the option will never be hidden
*/
const hide = () => false
/*
* Helper method to add the default hide() method to options who lack one
* as well as set the `menu` property to false (if it's missing)
*/
const completeOptions = options => {
if (options) {
for (const option in options) {
if (typeof options[option] === 'object') {
options[option] = { hide, menu: false, ...options[option] }
}
}
}
return options
}