diff options
| author | Johann150 <johann.galle@protonmail.com> | 2022-07-04 16:39:04 +0200 |
|---|---|---|
| committer | Johann150 <johann.galle@protonmail.com> | 2022-07-04 16:39:04 +0200 |
| commit | d748ba2c51211d3a2833fd1cb6ef898bc149d486 (patch) | |
| tree | c36fae05f983c74b7156317190ccab821d074f7d /packages/client/src | |
| parent | fix lint no-undef (diff) | |
| download | sharkey-d748ba2c51211d3a2833fd1cb6ef898bc149d486.tar.gz sharkey-d748ba2c51211d3a2833fd1cb6ef898bc149d486.tar.bz2 sharkey-d748ba2c51211d3a2833fd1cb6ef898bc149d486.zip | |
fix lint no-prototype-builtins
Diffstat (limited to 'packages/client/src')
| -rw-r--r-- | packages/client/src/components/form-dialog.vue | 2 | ||||
| -rw-r--r-- | packages/client/src/plugin.ts | 2 | ||||
| -rw-r--r-- | packages/client/src/scripts/array.ts | 2 | ||||
| -rw-r--r-- | packages/client/src/widgets/widget.ts | 5 |
4 files changed, 6 insertions, 5 deletions
diff --git a/packages/client/src/components/form-dialog.vue b/packages/client/src/components/form-dialog.vue index 5fd9ec460b..f05dde16f8 100644 --- a/packages/client/src/components/form-dialog.vue +++ b/packages/client/src/components/form-dialog.vue @@ -98,7 +98,7 @@ export default defineComponent({ created() { for (const item in this.form) { - this.values[item] = this.form[item].hasOwnProperty('default') ? this.form[item].default : null; + this.values[item] = this.form[item].default ?? null; } }, diff --git a/packages/client/src/plugin.ts b/packages/client/src/plugin.ts index ca7b4b73d3..de1c955675 100644 --- a/packages/client/src/plugin.ts +++ b/packages/client/src/plugin.ts @@ -38,7 +38,7 @@ export function install(plugin) { function createPluginEnv(opts) { const config = new Map(); for (const [k, v] of Object.entries(opts.plugin.config || {})) { - config.set(k, jsToVal(opts.plugin.configData.hasOwnProperty(k) ? opts.plugin.configData[k] : v.default)); + config.set(k, jsToVal(typeof opts.plugin.configData[k] !== 'undefined' ? opts.plugin.configData[k] : v.default)); } return { diff --git a/packages/client/src/scripts/array.ts b/packages/client/src/scripts/array.ts index 29d027de14..26c6195d66 100644 --- a/packages/client/src/scripts/array.ts +++ b/packages/client/src/scripts/array.ts @@ -98,7 +98,7 @@ export function groupOn<T, S>(f: (x: T) => S, xs: T[]): T[][] { export function groupByX<T>(collections: T[], keySelector: (x: T) => string) { return collections.reduce((obj: Record<string, T[]>, item: T) => { const key = keySelector(item); - if (!obj.hasOwnProperty(key)) { + if (typeof obj[key] === 'undefined') { obj[key] = []; } diff --git a/packages/client/src/widgets/widget.ts b/packages/client/src/widgets/widget.ts index 9626d01619..9fdfe7f3e1 100644 --- a/packages/client/src/widgets/widget.ts +++ b/packages/client/src/widgets/widget.ts @@ -36,8 +36,9 @@ export const useWidgetPropsManager = <F extends Form & Record<string, { default: const mergeProps = () => { for (const prop of Object.keys(propsDef)) { - if (widgetProps.hasOwnProperty(prop)) continue; - widgetProps[prop] = propsDef[prop].default; + if (typeof widgetProps[prop] === 'undefined') { + widgetProps[prop] = propsDef[prop].default; + } } }; watch(widgetProps, () => { |